|
44 | 44 | #include <fluent-bit/flb_config_format.h> |
45 | 45 | #include <fluent-bit/multiline/flb_ml.h> |
46 | 46 | #include <fluent-bit/flb_bucket_queue.h> |
| 47 | +#include <fluent-bit/flb_router.h> |
47 | 48 |
|
48 | 49 | const char *FLB_CONF_ENV_LOGLEVEL = "FLB_LOG_LEVEL"; |
49 | 50 |
|
@@ -367,6 +368,7 @@ struct flb_config *flb_config_init() |
367 | 368 | mk_list_init(&config->filters); |
368 | 369 | mk_list_init(&config->outputs); |
369 | 370 | mk_list_init(&config->proxies); |
| 371 | + cfl_list_init(&config->input_routes); |
370 | 372 | mk_list_init(&config->workers); |
371 | 373 | mk_list_init(&config->upstreams); |
372 | 374 | mk_list_init(&config->downstreams); |
@@ -613,6 +615,9 @@ void flb_config_exit(struct flb_config *config) |
613 | 615 | flb_config_task_map_resize(config, 0); |
614 | 616 | flb_routes_empty_mask_destroy(config); |
615 | 617 |
|
| 618 | + /* Clean up router input routes */ |
| 619 | + flb_router_routes_destroy(&config->input_routes); |
| 620 | + |
616 | 621 | flb_free(config); |
617 | 622 | } |
618 | 623 |
|
@@ -856,6 +861,9 @@ static int configure_plugins_type(struct flb_config *config, struct flb_cf *cf, |
856 | 861 | if (strcasecmp(kv->key, "name") == 0) { |
857 | 862 | continue; |
858 | 863 | } |
| 864 | + if (strcasecmp(kv->key, "routes") == 0) { |
| 865 | + continue; |
| 866 | + } |
859 | 867 |
|
860 | 868 | /* set ret to -1 to ensure that we treat any unhandled plugin or |
861 | 869 | * value types as errors. |
@@ -960,6 +968,7 @@ static int configure_plugins_type(struct flb_config *config, struct flb_cf *cf, |
960 | 968 | int flb_config_load_config_format(struct flb_config *config, struct flb_cf *cf) |
961 | 969 | { |
962 | 970 | int ret; |
| 971 | + flb_debug("[config] starting configuration loading"); |
963 | 972 | struct flb_kv *kv; |
964 | 973 | struct mk_list *head; |
965 | 974 | struct cfl_kvpair *ckv; |
@@ -1061,6 +1070,13 @@ int flb_config_load_config_format(struct flb_config *config, struct flb_cf *cf) |
1061 | 1070 | return -1; |
1062 | 1071 | } |
1063 | 1072 |
|
| 1073 | + /* Parse new router configuration */ |
| 1074 | + ret = flb_router_config_parse(cf, &config->input_routes, config); |
| 1075 | + if (ret == -1) { |
| 1076 | + flb_debug("[router] router configuration parsing failed"); |
| 1077 | + return -1; |
| 1078 | + } |
| 1079 | + |
1064 | 1080 | return 0; |
1065 | 1081 | } |
1066 | 1082 |
|
|
0 commit comments