Skip to content

Commit 6b33e3d

Browse files
committed
config: add list for input routes
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
1 parent 7dc9a91 commit 6b33e3d

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

include/fluent-bit/flb_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <fluent-bit/flb_log.h>
2828
#include <fluent-bit/flb_sds.h>
2929
#include <fluent-bit/flb_task_map.h>
30+
#include <cfl/cfl.h>
3031

3132
#include <monkey/mk_core.h>
3233

@@ -325,6 +326,9 @@ struct flb_config {
325326
int json_escape_unicode;
326327

327328
int dry_run;
329+
330+
/* New Router Configuration */
331+
struct cfl_list input_routes;
328332
};
329333

330334
#define FLB_CONFIG_LOG_LEVEL(c) (c->log->level)

src/flb_config.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <fluent-bit/flb_config_format.h>
4545
#include <fluent-bit/multiline/flb_ml.h>
4646
#include <fluent-bit/flb_bucket_queue.h>
47+
#include <fluent-bit/flb_router.h>
4748

4849
const char *FLB_CONF_ENV_LOGLEVEL = "FLB_LOG_LEVEL";
4950

@@ -367,6 +368,7 @@ struct flb_config *flb_config_init()
367368
mk_list_init(&config->filters);
368369
mk_list_init(&config->outputs);
369370
mk_list_init(&config->proxies);
371+
cfl_list_init(&config->input_routes);
370372
mk_list_init(&config->workers);
371373
mk_list_init(&config->upstreams);
372374
mk_list_init(&config->downstreams);
@@ -613,6 +615,9 @@ void flb_config_exit(struct flb_config *config)
613615
flb_config_task_map_resize(config, 0);
614616
flb_routes_empty_mask_destroy(config);
615617

618+
/* Clean up router input routes */
619+
flb_router_routes_destroy(&config->input_routes);
620+
616621
flb_free(config);
617622
}
618623

@@ -856,6 +861,9 @@ static int configure_plugins_type(struct flb_config *config, struct flb_cf *cf,
856861
if (strcasecmp(kv->key, "name") == 0) {
857862
continue;
858863
}
864+
if (strcasecmp(kv->key, "routes") == 0) {
865+
continue;
866+
}
859867

860868
/* set ret to -1 to ensure that we treat any unhandled plugin or
861869
* value types as errors.
@@ -960,6 +968,7 @@ static int configure_plugins_type(struct flb_config *config, struct flb_cf *cf,
960968
int flb_config_load_config_format(struct flb_config *config, struct flb_cf *cf)
961969
{
962970
int ret;
971+
flb_debug("[config] starting configuration loading");
963972
struct flb_kv *kv;
964973
struct mk_list *head;
965974
struct cfl_kvpair *ckv;
@@ -1061,6 +1070,13 @@ int flb_config_load_config_format(struct flb_config *config, struct flb_cf *cf)
10611070
return -1;
10621071
}
10631072

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+
10641080
return 0;
10651081
}
10661082

0 commit comments

Comments
 (0)