template() buggy for program()?
Hi, My Perl program launched by syslog-ng with a program() destination receives logs in this form: "<182>Mar 19 14:35:00 met-ixb postfix/smtpd[3234]: connect from l ocalhost[127.0.0.1]" (ie the log starts with '<', '1', '8', '2', '>'.) The *same* log line appears as: "Mar 19 14:35:00 hostname postfix/smtpd[3234]: connect from localhost[127.0.0.1]" in a file destination. My config looks like: destination dp_parse { program("/path/to/perl/program" template("$DATE $MSG\n")); }; destination df_tech { file("/path/to/file/tech.log" template("$DATE $HOST $MSG\n")); }; I am confused about this behavior, is it normal for a program() output to receive a syslog header? -- Loïc Minier <lool@dooz.org>
2004-03-19, p keltezéssel 15:42-kor Loic Minier ezt írta:
Hi,
My Perl program launched by syslog-ng with a program() destination receives logs in this form: "<182>Mar 19 14:35:00 met-ixb postfix/smtpd[3234]: connect from l ocalhost[127.0.0.1]"
(ie the log starts with '<', '1', '8', '2', '>'.)
The *same* log line appears as: "Mar 19 14:35:00 hostname postfix/smtpd[3234]: connect from localhost[127.0.0.1]"
in a file destination.
I am confused about this behavior, is it normal for a program() output to receive a syslog header?
hmm.. what is your syslog-ng version? -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
Balazs Scheidler <bazsi@balabit.hu> - Sat, Mar 20, 2004:
hmm.. what is your syslog-ng version?
I am using syslog-ng-1.6.2 built with libol-0.3.13 and gcc under Solaris 8 (sparc). -- Loïc Minier <lool@dooz.org>
2004-03-21, v keltezéssel 20:29-kor Loic Minier ezt írta:
Balazs Scheidler <bazsi@balabit.hu> - Sat, Mar 20, 2004:
hmm.. what is your syslog-ng version?
I am using syslog-ng-1.6.2 built with libol-0.3.13 and gcc under Solaris 8 (sparc).
you are right, this is a bug. syslog-ng always prepends the priority field even when a template is used. Try this patch: Index: afprogram.c =================================================================== RCS file: /var/cvs/syslog-ng/syslog-ng/src/afprogram.c,v retrieving revision 1.7 diff -u -r1.7 afprogram.c --- afprogram.c 31 Jan 2003 14:26:48 -0000 1.7 +++ afprogram.c 22 Mar 2004 11:55:07 -0000 @@ -142,8 +142,7 @@ struct ol_string *msg_line; if (self->template_output) { - msg_line = c_format("<%i>%fS", - msg->pri, + msg_line = c_format("%fS", expand_macros( self->cfg, self->template_output, -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
Balazs Scheidler <bazsi@balabit.hu> - Mon, Mar 22, 2004:
you are right, this is a bug. syslog-ng always prepends the priority field even when a template is used. Try this patch:
Thanks! Too bad the server is shipped, but I'll use it in my next packages. -- Loïc Minier <lool@dooz.org>
participants (2)
-
Balazs Scheidler
-
Loic Minier