Strange template definition problem
Hi, I am currently using the Open Source edition of syslog-ng version 3.0.1 on RedHat Linux 5.3 and 3.9. So far, there are not too many problems, but one strangeness occurs when defining templates. When I define the template inside the 'destination' configuration, everything works as expected: # + # Definition 1: Works fine. # - source s_local { unix-stream( "/dev/log" ); file( "/proc/kmsg" ); udp( ip( "127.0.0.1" ) port(514) ); tcp( ip( "127.0.0.1" ) port(514) keep-alive(yes) ); }; destination d_test { file( "/opt/sec/var/log/test" template( "$ISODATE -- $FACILITY -- $PRIORITY -- $HOST -- $MESSAGE\n----------\n" ) ); }; log { source(s_local); destination(d_test); }; The log entries look like this:
2009-01-22T19:33:35+01:00 -- authpriv -- notice -- linux4 -- LOG5[17309:3086130064]: syslog_in connected from 192.168.42.129:41105 ---------- 2009-01-22T19:33:35+01:00 -- authpriv -- notice -- linux4 -- LOG5[17309:3086060432]: syslog_in connected from 192.168.42.133:33950 ---------- 2009-01-22T19:33:35+01:00 -- authpriv -- notice -- linux4 -- LOG5[17309:3085990800]: syslog_in connected from 192.168.42.128:43163 ----------
So far, so good. But when I try global templates, I get a rather strange result: # + # Definition 2: Fails miserably. # - source s_local { unix-stream( "/dev/log" ); file( "/proc/kmsg" ); udp( ip( "127.0.0.1" ) port(514) ); tcp( ip( "127.0.0.1" ) port(514) keep-alive(yes) ); }; template t_test { template( "$ISODATE -- $FACILITY -- $PRIORITY -- $HOST -- $MESSAGE\n----------\n" ); }; destination d_test { file( "/opt/sec/var/log/test" template( t_test ) ); }; log { source(s_local); destination(d_test); }; What I'm getting is this (including marked blank lines):
---------- -- LOG5[17309:3086130064]: syslog_in connected from 192.168.42.129:41105 -- linux4 -- notice -- authpriv2009-01-22T19:33:35+01:0020 09-01-22T19:33:35+01:00 -- authpriv -- notice -- linux4 -- LOG5[17309:3086130064]: syslog_in connected from 192.168.42.129:41105 ----------
---------- -- LOG5[17309:3086060432]: syslog_in connected from 192.168.42.133:33950 -- linux4 -- notice -- authpriv2009-01-22T19:33:35+01:0020 09-01-22T19:33:35+01:00 -- authpriv -- notice -- linux4 -- LOG5[17309:3086060432]: syslog_in connected from 192.168.42.133:33950 ----------
---------- -- LOG5[17309:3085990800]: syslog_in connected from 192.168.42.128:43163 -- linux4 -- notice -- authpriv2009-01-22T19:33:35+01:0020 09-01-22T19:33:35+01:00 -- authpriv -- notice -- linux4 -- LOG5[17309:3085990800]: syslog_in connected from 192.168.42.128:43163
It looks a bit as if all elements of the filled template are output twice: First in reverse order, then again from start in correct order. This is reproducable on several machines. The only difference is the use of the global template in the second case instead of the inline template in the first. Am I making some stupid mistake, or is this a bug in syslog-ng? Best regards and thanks in advance for any suggestions, Peter. -- ------------------------------------------------------------------------- Peter Eckel System- und Netzwerkmanagement Postfach 1463 D-61284 Bad Homburg v.d.H. Tel.: +49 6172 969495 Mobil: +49 172 6812107 Fax: +49 6172 969845 EMail: Peter.Eckel@Eckel-EDV.de -------------------------------------------------------------------------
On Thu, 2009-01-22 at 20:00 +0100, Peter Eckel wrote:
Hi,
I am currently using the Open Source edition of syslog-ng version 3.0.1 on RedHat Linux 5.3 and 3.9. So far, there are not too many problems, but one strangeness occurs when defining templates.
you were right, sorry that it took so long for me to fix this issue. This patch fixes it: commit 60aeab750e952b3a69714ea47e2aa31683c761fd Author: Balazs Scheidler <bazsi@balabit.hu> Date: Thu Feb 5 10:50:45 2009 +0100 fixed the references for non-inline templates this patch fixes template expansion for non-inline templates. The parser code caused these templates to be compiled as many times as they were referenced, which in turn concatenated the previously compiled value and the currently compiled value. I've just pushed it to git.balabit.hu in the syslog-ng-3.0 repo. Tomorrow's snapshot should contain the fix. -- Bazsi
Hi Balasz,
you were right, sorry that it took so long for me to fix this issue.
This patch fixes it:
commit 60aeab750e952b3a69714ea47e2aa31683c761fd
I tried the current git version, and everything is working fine now. Thanks! That fix saves lots of typing :-) Regards, Peter.
Hi, when building syslog-ng from the latest git source, I found a problem with libdbi that occurs on my Redhat ES 5.2 systems that do not have libdbi installed (neither have my customer's systems):
commit 6ca874d7ea362e4f0286245542f7ea601743c72d Author: Balazs Scheidler <bazsi@balabit.hu> Date: Mon Feb 9 11:44:09 2009 +0100
[configure] added kludge to recognize libdbi without an installed dbi.pc file
libdbi does not always install a pkg-config file, work without one, assuming it was installed to the default location.
Unfortunately configure now also recognizes libdbi if it is not installed at all: [sec@linux1 sbin]$ rpmquery libdbi package libdbi is not installed [sec@linux1 sbin]$ rpmquery libdbi-devel package libdbi-devel is not installed [sec@linux1 syslog-ng.git]$ ./configure --disable-ssl --disable-sql --disable-ipv6 --enable-pcre --prefix=/opt/sec/local CFLAGS=-I/opt/sec/local/include LDFLAGS=-L/opt/sec/local/lib [...] checking for dlsym in -ldl... (cached) yes checking for LIBDBI... no checking for LIBDBI... yes checking for LIBNET... which: no libnet-config in (/opt/CollabNet_Subversion/bin:/opt/sec/local/bin:/usr/kerberos/bin:/opt/sec/local/bin:/opt/CollabNet_Subversion/bin:/usr/local/bin:/bin:/usr/bin:/home/sec/bin) no [...] [sec@linux1 syslog-ng.git]$ make [...] gcc -I/opt/sec/local/include -Wall -L/opt/sec/local/lib -o syslog-ng main.o libsyslog-ng.a -lrt -lnsl -Wl,-Bstatic -lfl -L/lib -lglib-2.0 -L/opt/sec/local/lib -levtlog -L/usr/kerberos/lib -lssl -lcrypto -ldl -lz -lz -lwrap -lpcre -Wl,-Bdynamic -ldbi -ldl /usr/bin/ld: cannot find -ldbi collect2: ld returned 1 exit status make[2]: *** [syslog-ng] Error 1 make[2]: Leaving directory `/home/sec/syslog-ng.git/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/sec/syslog-ng.git' make: *** [all] Error 2 The latest 3.0.1 tarball worked fine. Peter.
On Wed, 2009-02-11 at 19:40 +0100, Peter Eckel wrote:
Hi,
when building syslog-ng from the latest git source, I found a problem with libdbi that occurs on my Redhat ES 5.2 systems that do not have libdbi installed (neither have my customer's systems):
commit 6ca874d7ea362e4f0286245542f7ea601743c72d Author: Balazs Scheidler <bazsi@balabit.hu> Date: Mon Feb 9 11:44:09 2009 +0100
[configure] added kludge to recognize libdbi without an installed dbi.pc file
libdbi does not always install a pkg-config file, work without one, assuming it was installed to the default location.
Unfortunately configure now also recognizes libdbi if it is not installed at all:
[sec@linux1 sbin]$ rpmquery libdbi package libdbi is not installed
[sec@linux1 sbin]$ rpmquery libdbi-devel package libdbi-devel is not installed
[sec@linux1 syslog-ng.git]$ ./configure --disable-ssl --disable-sql --disable-ipv6 --enable-pcre --prefix=/opt/sec/local CFLAGS=-I/opt/sec/local/include LDFLAGS=-L/opt/sec/local/lib [...] checking for dlsym in -ldl... (cached) yes checking for LIBDBI... no checking for LIBDBI... yes
Ahh.. you're right. This patch should fix it: commit 6b299cf2c9e577acd6b48eb686cec45ff209aa6a Author: Balazs Scheidler <bazsi@balabit.hu> Date: Sat Feb 14 19:10:54 2009 +0100 [configure] fixed LIBDBI detection, the previous change always enabled SQL support regardless if libdbi was installed or not -- Bazsi
participants (2)
-
Balazs Scheidler
-
Peter Eckel