[PATCH] log messages get duplicated when using templates.

Angus Salkeld angus.salkeld at alliedtelesis.co.nz
Sun Feb 1 22:48:10 CET 2009


The parser calls cfg_check_template() at the definition
and reference to a template.

cfg_check_template() then calls log_template_compile() which
keeps adding more copies of the same compiled template to the
list. So the log writer duplicates the log messages by the number
of times you reference the template in the config file.

So this patch simply clears the compiled_template list on entry to
log_template_compile().

Signed-off-by: Angus Salkeld <angus.salkeld at alliedtelesis.co.nz>
Acked-by: Chris Packham <chris.packham at alliedtelesis.co.nz>
---
 src/templates.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/templates.c b/src/templates.c
index 3293057..42a7153 100644
--- a/src/templates.c
+++ b/src/templates.c
@@ -647,6 +647,7 @@ log_template_compile(LogTemplate *self, GError =
**error)
  =20
   g_return_val_if_fail(error =3D=3D NULL || *error =3D=3D NULL, FALSE);
  =20
+  log_template_reset_compiled(self);
   p =3D self->template;
  =20
   while (*p)
--=20
1.5.4.5


--=__Part6840AAD0.0__=--


More information about the syslog-ng mailing list