diff --git a/plugins/out_parseable/parseable.c b/plugins/out_parseable/parseable.c index 480e6775340..646c308406c 100644 --- a/plugins/out_parseable/parseable.c +++ b/plugins/out_parseable/parseable.c @@ -123,16 +123,26 @@ static void cb_parseable_flush(struct flb_event_chunk *event_chunk, flb_plg_info(ctx->ins, "EN: %s", ctx->p_exclude_namespaces); - if (mk_list_is_empty(&ctx->p_exclude_namespaces)) { - flb_plg_info(ctx->ins, "No exclude namespaces configured."); - } else { - struct mk_list *head; - struct flb_slist_entry *entry; - mk_list_foreach(head, &ctx->p_exclude_namespaces) { + struct mk_list *head; + struct flb_slist_entry *entry; + + if (ctx->p_exclude_namespaces) { + mk_list_foreach(head, ctx->p_exclude_namespaces) { entry = mk_list_entry(head, struct flb_slist_entry, _head); flb_plg_info(ctx->ins, "Exclude namespace: %s", entry->str); } - } + } + + // if (mk_list_is_empty(&ctx->p_exclude_namespaces)) { + // flb_plg_info(ctx->ins, "No exclude namespaces configured."); + // } else { + // struct mk_list *head; + // struct flb_slist_entry *entry; + // mk_list_foreach(head, &ctx->p_exclude_namespaces) { + // entry = mk_list_entry(head, struct flb_slist_entry, _head); + // flb_plg_info(ctx->ins, "Exclude namespace: %s", entry->str); + // } + // } flb_sds_t namespace_name = flb_sds_create_size(256); // Dynamic string if (body_copy != NULL) { @@ -147,35 +157,35 @@ static void cb_parseable_flush(struct flb_event_chunk *event_chunk, // Debug: Print the extracted namespace name flb_plg_info(ctx->ins, "Extracted namespace_name: %s", namespace_name); - // Exclusion logic (revised) - if (!mk_list_is_empty(&ctx->p_exclude_namespaces)) { - flb_plg_info(ctx->ins, "Checking exclude namespaces..."); + // // Exclusion logic (revised) + // if (!mk_list_is_empty(&ctx->p_exclude_namespaces)) { + // flb_plg_info(ctx->ins, "Checking exclude namespaces..."); - struct mk_list *head; - struct flb_slist_entry *entry; - mk_list_foreach(head, &ctx->p_exclude_namespaces) { - entry = mk_list_entry(head, struct flb_slist_entry, _head); + // struct mk_list *head; + // struct flb_slist_entry *entry; + // mk_list_foreach(head, &ctx->p_exclude_namespaces) { + // entry = mk_list_entry(head, struct flb_slist_entry, _head); - // Debug: Print each exclude namespace in the list - flb_plg_info(ctx->ins, "Checking against exclude namespace: %s", entry->str); + // // Debug: Print each exclude namespace in the list + // flb_plg_info(ctx->ins, "Checking against exclude namespace: %s", entry->str); - if (flb_sds_cmp(entry->str, namespace_name, flb_sds_len(namespace_name)) == 0) { - flb_plg_info(ctx->ins, "Skipping excluded namespace: %s", namespace_name); + // if (flb_sds_cmp(entry->str, namespace_name, flb_sds_len(namespace_name)) == 0) { + // flb_plg_info(ctx->ins, "Skipping excluded namespace: %s", namespace_name); - // Cleanup - flb_sds_destroy(namespace_name); - flb_sds_destroy(body); - flb_sds_destroy(body_copy); - msgpack_unpacked_destroy(&result); + // // Cleanup + // flb_sds_destroy(namespace_name); + // flb_sds_destroy(body); + // flb_sds_destroy(body_copy); + // msgpack_unpacked_destroy(&result); - // Skip sending the HTTP request - FLB_OUTPUT_RETURN(FLB_OK); - } - } - } else { - // Debug: List of exclude namespaces is empty - flb_plg_info(ctx->ins, "No exclude namespaces configured."); - } + // // Skip sending the HTTP request + // FLB_OUTPUT_RETURN(FLB_OK); + // } + // } + // } else { + // // Debug: List of exclude namespaces is empty + // flb_plg_info(ctx->ins, "No exclude namespaces configured."); + // } } } else { // Debug: Could not find the namespace_name in body_copy @@ -308,7 +318,7 @@ static struct flb_config_map config_map[] = { "The port on the host to send logs to." }, { - FLB_CONFIG_MAP_SLIST, "P_Exclude_Namespaces", NULL, + FLB_CONFIG_MAP_CLIST, "P_Exclude_Namespaces", NULL, 0, FLB_TRUE, offsetof(struct flb_out_parseable, p_exclude_namespaces), "A space-separated list of Kubernetes namespaces to exclude from log forwarding." }, diff --git a/plugins/out_parseable/parseable.h b/plugins/out_parseable/parseable.h index ab69338d07d..5d8cc0c2e15 100644 --- a/plugins/out_parseable/parseable.h +++ b/plugins/out_parseable/parseable.h @@ -10,7 +10,7 @@ struct flb_out_parseable { flb_sds_t p_username; flb_sds_t p_password; flb_sds_t p_stream; - struct mk_list p_exclude_namespaces; // Use mk_list for namespace exclusion + struct mk_list *p_exclude_namespaces; // Use mk_list for namespace exclusion struct flb_upstream *upstream; struct flb_output_instance *ins; };