Skip to content

Commit 55a499c

Browse files
committed
output: Handle plugin aliases
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 2de7fec commit 55a499c

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/flb_output.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <fluent-bit/flb_macros.h>
3636
#include <fluent-bit/flb_utils.h>
3737
#include <fluent-bit/flb_plugin.h>
38+
#include <fluent-bit/flb_plugin_alias.h>
3839
#include <fluent-bit/flb_plugin_proxy.h>
3940
#include <fluent-bit/flb_http_client_debug.h>
4041
#include <fluent-bit/flb_output_thread.h>
@@ -128,6 +129,7 @@ static int check_protocol(const char *prot, const char *output)
128129
{
129130
int len;
130131
char *p;
132+
const char *alias_target;
131133

132134
p = strstr(output, "://");
133135
if (p && p != output) {
@@ -137,12 +139,16 @@ static int check_protocol(const char *prot, const char *output)
137139
len = strlen(output);
138140
}
139141

140-
if (strlen(prot) != len) {
141-
return 0;
142+
/* Output plugin match */
143+
if (strlen(prot) == (size_t) len &&
144+
strncasecmp(prot, output, len) == 0) {
145+
return 1;
142146
}
143147

144-
/* Output plugin match */
145-
if (strncasecmp(prot, output, len) == 0) {
148+
alias_target = flb_plugin_alias_get(FLB_PLUGIN_OUTPUT, output, len);
149+
if (alias_target != NULL &&
150+
strlen(alias_target) == strlen(prot) &&
151+
strcasecmp(prot, alias_target) == 0) {
146152
return 1;
147153
}
148154

0 commit comments

Comments
 (0)