[PATCH] logrewrite: Fix the logrewrite cloning functions.
Repair the rewrite clone funcions, to correctly clone the value_handle and conditions aswell. Without this, if we use rewrite in multiple logpaths, only the first will behave correctly, the cloned ones will all rewrite the $MESSAGE macro instead, because that's the default. Signed-off-By: Zoltan Fried <deirf@balabit.hu> Signed-off-By: Gergely Nagy <algernon@balabit.hu> --- lib/logrewrite.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/logrewrite.c b/lib/logrewrite.c index d282f6f..a578439 100644 --- a/lib/logrewrite.c +++ b/lib/logrewrite.c @@ -165,6 +165,8 @@ log_rewrite_subst_clone(LogProcessPipe *s) cloned = (LogRewriteSubst *) log_rewrite_subst_new(self->replacement->template); cloned->matcher = log_matcher_ref(self->matcher); + cloned->super.value_handle = self->super.value_handle; + cloned->super.condition = self->super.condition; return &cloned->super.super.super; } @@ -227,6 +229,8 @@ log_rewrite_set_clone(LogProcessPipe *s) LogRewriteSet *cloned; cloned = (LogRewriteSet *) log_rewrite_set_new(self->value_template->template); + cloned->super.value_handle = self->super.value_handle; + cloned->super.condition = self->super.condition; return &cloned->super.super.super; } -- 1.7.7.3
Thanks, but I've picked this from the same internal git tree as: commit 1b52fd8741b33c20e7cdc06b907fb76a981c8874 Author: Balazs Scheidler <bazsi@balabit.hu> Date: Fri Nov 25 12:38:40 2011 +0100 [logrewrite] Repair logrewrite *_clone and *_subst_clone functions (fixes: #7686) Repair rewrite clone functions because we did not clone $MACRO id and conditions. Before this patch if we used rewrite in config file and use example PIPE source we rewrited $MESSAGE macro instead of macro in config file because the $MESSAGE macro was the default macro. Signed-off-by: Fried Zoltan <deirf@balabit.hu> Signed-off-by: Balazs Scheidler <bazsi@balabit.hu> On Fri, 2011-11-18 at 14:54 +0100, Gergely Nagy wrote:
Repair the rewrite clone funcions, to correctly clone the value_handle and conditions aswell.
Without this, if we use rewrite in multiple logpaths, only the first will behave correctly, the cloned ones will all rewrite the $MESSAGE macro instead, because that's the default.
Signed-off-By: Zoltan Fried <deirf@balabit.hu> Signed-off-By: Gergely Nagy <algernon@balabit.hu> --- lib/logrewrite.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
-- Bazsi
participants (2)
-
Balazs Scheidler
-
Gergely Nagy