diff --git a/lib/cfg-grammar.y b/lib/cfg-grammar.y index 87891bce3..59decde07 100644 --- a/lib/cfg-grammar.y +++ b/lib/cfg-grammar.y @@ -567,14 +567,14 @@ expr_stmt source_stmt : KW_SOURCE string '{' source_content '}' { - $$ = log_expr_node_new_source($2, $4, &@$); + $$ = log_expr_node_new_source($2, $4, &@1); free($2); } ; dest_stmt : KW_DESTINATION string '{' dest_content '}' { - $$ = log_expr_node_new_destination($2, $4, &@$); + $$ = log_expr_node_new_destination($2, $4, &@1); free($2); } ; diff --git a/lib/cfg-tree.c b/lib/cfg-tree.c index 748993c04..d86b2ac63 100644 --- a/lib/cfg-tree.c +++ b/lib/cfg-tree.c @@ -26,7 +26,6 @@ #include "logmpx.h" #include "logpipe.h" #include "metrics-pipe.h" -#include "cfg-source.h" #include @@ -283,14 +282,6 @@ log_expr_node_new(gint layout, gint content, const gchar *name, LogExprNode *chi self->line = yylloc->first_line; self->column = yylloc->first_column; } - if (yylloc && (debug_flag || 1)) - { - CFG_LTYPE lloc = *yylloc; - lloc.last_column = 255; - GString *text = g_string_new(""); - cfg_source_extract_source_text(configuration->lexer, &lloc, text); - self->expr_text = g_string_free(text, FALSE); - } return self; } @@ -317,7 +308,6 @@ _log_expr_node_free(LogExprNode *self) self->aux_destroy(self->aux); g_free(self->name); g_free(self->filename); - g_free(self->expr_text); g_free(self); } diff --git a/lib/cfg-tree.h b/lib/cfg-tree.h index 06117b5e1..4e446881d 100644 --- a/lib/cfg-tree.h +++ b/lib/cfg-tree.h @@ -124,7 +124,6 @@ struct _LogExprNode gchar *filename; gint line, column; gint child_id; - gchar *expr_text; }; gint log_expr_node_lookup_flag(const gchar *flag); diff --git a/lib/filterx/filterx-expr.c b/lib/filterx/filterx-expr.c index 8530df7b4..1e039982a 100644 --- a/lib/filterx/filterx-expr.c +++ b/lib/filterx/filterx-expr.c @@ -28,7 +28,6 @@ #include "mainloop.h" #include "stats/stats-registry.h" #include "stats/stats-cluster-single.h" -#include "perf/perf.h" void filterx_expr_set_location_with_text(FilterXExpr *self, CFG_LTYPE *lloc, const gchar *text) @@ -37,7 +36,7 @@ filterx_expr_set_location_with_text(FilterXExpr *self, CFG_LTYPE *lloc, const gc self->lloc = g_new0(CFG_LTYPE, 1); *self->lloc = *lloc; - if ((debug_flag || 1) && text) + if (debug_flag && text) self->expr_text = g_strdup(text); } @@ -47,7 +46,7 @@ filterx_expr_set_location(FilterXExpr *self, CfgLexer *lexer, CFG_LTYPE *lloc) if (!self->lloc) self->lloc = g_new0(CFG_LTYPE, 1); *self->lloc = *lloc; - if (debug_flag || 1) + if (debug_flag) { GString *res = g_string_sized_new(0); cfg_source_extract_source_text(lexer, lloc, res); @@ -111,7 +110,7 @@ _init_sc_key_name(FilterXExpr *self, gchar *buf, gsize buf_len) gboolean filterx_expr_init_method(FilterXExpr *self, GlobalConfig *cfg) { - gchar buf[256]; + gchar buf[64]; _init_sc_key_name(self, buf, sizeof(buf)); stats_lock(); @@ -124,22 +123,6 @@ filterx_expr_init_method(FilterXExpr *self, GlobalConfig *cfg) stats_cluster_single_key_set(&sc_key, buf, labels, labels_len); stats_register_counter(STATS_LEVEL3, &sc_key, SC_TYPE_SINGLE_VALUE, &self->eval_count); stats_unlock(); - - if (!perf_is_trampoline_address(self->eval)) - { - //g_snprintf(buf, sizeof(buf), "filterx_%s_eval(%s)", self->type, self->name ? : "anon"); - if (self->lloc) -// g_snprintf(buf, sizeof(buf), "filterx::%s:%d:%d|\t%s", -// self->lloc->name, self->lloc->first_line, self->lloc->first_column, -// self->expr_text ? : "n/a"); - g_snprintf(buf, sizeof(buf), "filterx::%s", self->expr_text ? : "n/a"); - else - g_snprintf(buf, sizeof(buf), "filterx::%s(%s)", self->type, self->name ? : "anon"); -// msg_error("installing trampoline on expr", -// evt_tag_str("expr", buf)); - self->eval = perf_generate_trampoline(self->eval, buf); - } - return TRUE; } diff --git a/lib/logmpx.c b/lib/logmpx.c index 49a63b02a..6cd119756 100644 --- a/lib/logmpx.c +++ b/lib/logmpx.c @@ -93,11 +93,6 @@ log_multiplexer_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_op * write protected so that changes in those branches don't overwrite * data we still need */ - msg_trace("logmpx: making message readonly", - evt_tag_int("next_hops", self->next_hops->len), - evt_tag_int("pipe_next", !!self->super.pipe_next), - log_expr_node_location_tag(self->super.expr_node), - evt_tag_str("expr_text", self->super.expr_node && self->super.expr_node->expr_text ? self->super.expr_node->expr_text : "n/a")); filterx_eval_prepare_for_fork(path_options->filterx_context, &msg, path_options); log_msg_write_protect(msg); } diff --git a/lib/logpipe.c b/lib/logpipe.c index 1f0b47097..2a3fbdec6 100644 --- a/lib/logpipe.c +++ b/lib/logpipe.c @@ -25,7 +25,6 @@ #include "logpipe.h" #include "cfg-tree.h" #include "cfg-walker.h" -#include "perf/perf.h" gboolean (*pipe_single_step_hook)(LogPipe *pipe, LogMessage *msg, const LogPathOptions *path_options); @@ -147,20 +146,6 @@ log_pipe_clone_method(LogPipe *dst, const LogPipe *src) log_pipe_set_options(dst, &src->options); } -static gboolean -log_pipe_post_config_init_method(LogPipe *self) -{ -// GlobalConfig *cfg = log_pipe_get_config(self); - if (self->flags & PIF_CONFIG_RELATED) - { - gchar buf[256]; - /* FIXME: check that perf profiling is enabled */ - if (!perf_is_trampoline_address(self->queue)) - self->queue = perf_generate_trampoline(self->queue, log_expr_node_format_location(self->expr_node, buf, sizeof(buf))); - } - return TRUE; -} - void log_pipe_init_instance(LogPipe *self, GlobalConfig *cfg) { @@ -169,7 +154,7 @@ log_pipe_init_instance(LogPipe *self, GlobalConfig *cfg) self->pipe_next = NULL; self->persist_name = NULL; self->plugin_name = NULL; - self->post_config_init = log_pipe_post_config_init_method; + self->queue = log_pipe_forward_msg; self->free_fn = log_pipe_free_method; self->arcs = _arcs;