Skip to content

Commit bebe711

Browse files
nokute78edsiper
authored andcommitted
ouput: report error message if user sets undefined output plugin
Signed-off-by: Takahiro YAMASHITA <nokute78@gmail.com>
1 parent b6c0184 commit bebe711

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

include/fluent-bit/flb_output.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,5 +303,5 @@ void flb_output_pre_run(struct flb_config *config);
303303
void flb_output_exit(struct flb_config *config);
304304
void flb_output_set_context(struct flb_output_instance *ins, void *context);
305305
int flb_output_init(struct flb_config *config);
306-
306+
int flb_output_check(struct flb_config *config);
307307
#endif

src/flb_output.c

+9
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,12 @@ void flb_output_set_context(struct flb_output_instance *ins, void *context)
358358
{
359359
ins->context = context;
360360
}
361+
362+
/* Check that at least one Output is enabled */
363+
int flb_output_check(struct flb_config *config)
364+
{
365+
if (mk_list_is_empty(&config->outputs) == 0) {
366+
return -1;
367+
}
368+
return 0;
369+
}

src/fluent-bit.c

+6
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,12 @@ int main(int argc, char **argv)
529529
flb_utils_error(FLB_ERR_INPUT_UNDEF);
530530
}
531531

532+
/* Outputs */
533+
ret = flb_output_check(config);
534+
if (ret == -1) {
535+
flb_utils_error(FLB_ERR_OUTPUT_UNDEF);
536+
}
537+
532538
flb_banner();
533539
if (config->verbose == FLB_TRUE) {
534540
flb_utils_print_setup(config);

0 commit comments

Comments
 (0)