[syslog-ng] CSV parser ignoring template()?

Balazs Scheidler bazsi at balabit.hu
Mon Jan 16 22:33:58 CET 2012


On Sun, 2012-01-08 at 11:11 -0500, John Morrissey wrote:
> I'm upgrading from 3.1.3 to 3.3.3. My configuration has a CSV parser:
> 
> parser p_find_role {
>     csv-parser(
>         columns("ROLE", "REMAINDER")
>         delimiters("0123456789.")
>         template("${HOST}")
>     );
> };
> 
> With 3.1.3, this takes the first word of the machine's hostname and stores
> it in $ROLE, but 3.3.3 seems to ignore template() and operates on the log
> message instead, storing the first field of the message in $ROLE.

Here is a quickfix:

diff --git a/modules/csvparser/csvparser.c b/modules/csvparser/csvparser.c
index 1be19fd..57f2ad0 100644
--- a/modules/csvparser/csvparser.c
+++ b/modules/csvparser/csvparser.c
@@ -350,6 +350,8 @@ log_csv_parser_clone(LogProcessPipe *s)
   cloned->quotes_end = g_strdup(self->quotes_end);
   cloned->null_value = self->null_value ? g_strdup(self->null_value) : NULL;
   cloned->flags = self->flags;
+
+  cloned->super.super.template = log_template_ref(self->super.super.template);
   for (l = self->super.columns; l; l = l->next)
     {
       cloned->super.columns = g_list_append(cloned->super.columns, g_strdup(l->data));


This should be properly implemented a different way, by delegating the clone 
operation to the superclass, however I got to go now, just wanted to let you 
know about the fix.

Thanks for reporting this.
-- 
Bazsi




More information about the syslog-ng mailing list