static void log_filter_pipe_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options, gpointer user_data) { LogFilterPipe *self = (LogFilterPipe *) s; gchar buf[128]; gboolean res; msg_debug("Filter rule evaluation begins", evt_tag_str("rule", self->name), evt_tag_str("location", log_expr_node_format_location(s->expr_node, buf, sizeof(buf))), NULL); if (self->expr->modify) log_msg_make_writable(&msg, path_options); res = filter_expr_eval(self->expr, msg); msg_debug("Filter rule evaluation result", evt_tag_str("result", res ? "match" : "not-match"), evt_tag_str("rule", self->name), evt_tag_str("location", log_expr_node_format_location(s->expr_node, buf, sizeof(buf))), NULL); if (res) { log_pipe_forward_msg(s, msg, path_options); } else { if (path_options->matched) (*path_options->matched) = FALSE; log_msg_drop(msg, path_options); } }
static void log_rewrite_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options, gpointer user_data) { LogRewrite *self = (LogRewrite *) s; gchar buf[128]; gssize length; const gchar *value; if (self->condition && !filter_expr_eval_root(self->condition, &msg, path_options)) { msg_debug("Rewrite condition unmatched, skipping rewrite", evt_tag_str("value", log_msg_get_value_name(self->value_handle, NULL)), NULL); } else { self->process(self, &msg, path_options); } if (G_UNLIKELY(debug_flag)) { value = log_msg_get_value(msg, self->value_handle, &length); msg_debug("Rewrite expression evaluation result", evt_tag_str("value", log_msg_get_value_name(self->value_handle, NULL)), evt_tag_printf("new_value", "%.*s", (gint) length, value), evt_tag_str("rule", self->name), evt_tag_str("location", log_expr_node_format_location(s->expr_node, buf, sizeof(buf))), NULL); } log_pipe_forward_msg(s, msg, path_options); }