filter_nest: support config map
@@ -71,6 +71,11 @@ static int configure(struct filter_nest_ctx *ctx,
ctx->remove_prefix = false;
ctx->add_prefix = false;
+ if (flb_filter_config_map_set(f_ins, ctx) < 0) {
+ flb_plg_error(f_ins, "unable to load configuration");
+ return -1;
+ }
+
mk_list_foreach(head, &f_ins->properties) {
kv = mk_list_entry(head, struct flb_kv, _head);
@@ -626,11 +631,47 @@ static int cb_nest_exit(void *data, struct flb_config *config)
return 0;
}
+/* Configuration properties map */
+static struct flb_config_map config_map[] = {
+ {
+ FLB_CONFIG_MAP_STR, "Operation", NULL,
+ 0, FLB_FALSE, 0,
+ "Select the operation nest or lift"
+ },
+ {
+ FLB_CONFIG_MAP_STR, "Wildcard", NULL,
+ 0, FLB_FALSE, 0,
+ "Nest records which field matches the wildcard"
+ },
+ {
+ FLB_CONFIG_MAP_STR, "Nest_under", NULL,
+ 0, FLB_FALSE, 0,
+ "Nest records matching the Wildcard under this key"
+ },
+ {
+ FLB_CONFIG_MAP_STR, "Nested_under", NULL,
+ 0, FLB_FALSE, 0,
+ "Lift records nested under the Nested_under key"
+ },
+ {
+ FLB_CONFIG_MAP_STR, "Add_prefix", NULL,
+ 0, FLB_FALSE, 0,
+ "Prefix affected keys with this string"
+ },
+ {
+ FLB_CONFIG_MAP_STR, "Remove_prefix", NULL,
+ 0, FLB_FALSE, 0,
+ "Remove prefix from affected keys if it matches this string"
+ },
+ {0}
+};
+
struct flb_filter_plugin filter_nest_plugin = {
.name = "nest",
.description = "nest events by specified field values",
.cb_init = cb_nest_init,
.cb_filter = cb_nest_filter,
.cb_exit = cb_nest_exit,
+ .config_map = config_map,
.flags = 0
};
