[syslog-ng] Syntax check / reload / duplicate messages issues in 3.2.2 (and 3.1.1)
Jakub Jankowski
shasta at toxcorp.com
Fri Feb 18 15:13:35 CET 2011
Hi,
I've came across a weird bug in syslog-ng OSE 3.1.1, which is also present
in 3.2.2: when I add a non-existant destination to syslog-ng config:
[root at test-syslog-ng ~]# echo 'log { source(s_sys); filter(f_default); destination(d_nonexistent); };' >> /etc/syslog-ng/syslog-ng.conf
it passes syntax checking ($SYSLOGNG_OPTIONS is basically --no-caps -p /pid/file/path
- I need no-caps because this is virtual environment):
[root at test-syslog-ng ~]# . /etc/sysconfig/syslog-ng && syslog-ng -s $SYSLOGNG_OPTIONS
[root at test-syslog-ng ~]# echo $?
0
but after /etc/init.d/syslog-ng reload (HUP) this happens:
Feb 18 14:17:40 test-syslog-ng syslog-ng[30198]: Error in configuration, unresolved destination reference; destination='d_nonexistent'
Feb 18 14:17:40 test-syslog-ng syslog-ng[30198]: Error in configuration, unresolved destination reference; destination='d_nonexistent'
Feb 18 14:17:40 test-syslog-ng syslog-ng[30198]: Error initializing new configuration, reverting to old config;
Feb 18 14:17:40 test-syslog-ng syslog-ng[30198]: Error initializing new configuration, reverting to old config;
Feb 18 14:17:40 test-syslog-ng syslog-ng[30198]: Configuration reload request received, reloading configuration;
Feb 18 14:17:40 test-syslog-ng syslog-ng[30198]: Configuration reload request received, reloading configuration;
Afterwards, everything is logged twice(!)
[root at test-syslog-ng ~]# R=$RANDOM; echo $R; logger -t test $R
578
[root at test-syslog-ng ~]# grep "test: $R" /var/log/messages
Feb 18 14:38:28 test-syslog-ng test: 578
Feb 18 14:38:28 test-syslog-ng test: 578
[root at test-syslog-ng ~]#
Another reload, and afterwards every message is logged 3 times:
[root at test-syslog-ng ~]# service syslog-ng reload
Reloading syslog-ng: [ OK ]
[root at test-syslog-ng ~]# R=$RANDOM; echo $R; logger -t test $R
13143
[root at test-syslog-ng ~]# grep "test: $R" /var/log/messages
Feb 18 14:39:57 test-syslog-ng test: 13143
Feb 18 14:39:57 test-syslog-ng test: 13143
Feb 18 14:39:57 test-syslog-ng test: 13143
[root at test-syslog-ng ~]#
Can anyone confirm this behaviour? It's all fine if I stop
syslog-ng and start it again (well, try to start):
[root at test-syslog-ng ~]# service syslog-ng start
Starting syslog-ng: Error in configuration, unresolved destination reference; destination='d_nonexistent'
[FAILED]
I see two bugs here:
1) syntax checking (-s) is, well, just syntax checking - but doesn't guarantee
that config is valid.
2) after reloading configuration with unresolved destination N times, every
message is logged 1+N times.
My environment: CentOS5, syslog-ng (without any patches) built from my own .spec, which
I made by adapting EPEL srpm (2.x) to 3.x.
[root at test-syslog-ng ~]# syslog-ng -V
syslog-ng 3.2.2
Installer-Version: 3.2.2
Revision: ssh+git://bazsi@git.balabit//var/scm/git/syslog-ng/syslog-ng-ose--mainline--3.2#master#1d3f396485eb47b1ff6aa18ac4f1c4cd51c0ea4c
Compile-Date: Jan 26 2011 11:44:50
Enable-Threads: on
Enable-Debug: off
Enable-GProf: off
Enable-Memtrace: off
Enable-Sun-STREAMS: off
Enable-IPv6: on
Enable-Spoof-Source: on
Enable-TCP-Wrapper: on
Enable-SSL: on
Enable-SQL: on
Enable-Linux-Caps: on
Enable-Pcre: off
Enable-Pacct: off
[root at test-syslog-ng ~]#
Config file is pretty straightforward:
[root at test-syslog-ng ~]# cat /etc/syslog-ng/syslog-ng.conf
@version: 3.2
options {
flush_lines (0);
time_reopen (10);
log_fifo_size (1000);
long_hostnames (off);
use_dns (no);
use_fqdn (no);
create_dirs (yes);
keep_hostname (yes);
};
source s_sys {
file ("/proc/kmsg" program_override("kernel") flags(no-multi-line));
unix-stream ("/dev/log" flags(no-multi-line));
internal();
# udp(ip(0.0.0.0) port(514) flags(no-multi-line));
};
destination d_cons { file("/dev/console" group("root")); };
destination d_mesg { file("/var/log/messages" group("root")); };
destination d_auth { file("/var/log/secure" group("root")); };
destination d_mail { file("/var/log/maillog" group("root") flush_lines(10)); };
destination d_spol { file("/var/log/spooler" group("root")); };
destination d_boot { file("/var/log/boot.log" group("root")); };
destination d_cron { file("/var/log/cron" group("root")); };
destination d_kern { file("/var/log/kern" group("root")); };
destination d_mlal { usertty("*"); };
# Facilities/levels
filter f_kernel { facility(kern); };
filter f_default { level(info..emerg) and
not (facility(mail)
or facility(authpriv)
or facility(cron)); };
filter f_auth { facility(authpriv); };
filter f_mail { facility(mail); };
filter f_emergency { level(emerg); };
filter f_news { facility(uucp) or
(facility(news)
and level(crit..emerg)); };
filter f_boot { facility(local7); };
filter f_cron { facility(cron); };
log { source(s_sys); filter(f_kernel); destination(d_kern); };
log { source(s_sys); filter(f_default); destination(d_mesg); };
log { source(s_sys); filter(f_auth); destination(d_auth); };
log { source(s_sys); filter(f_mail); destination(d_mail); };
log { source(s_sys); filter(f_emergency); destination(d_mlal); };
log { source(s_sys); filter(f_news); destination(d_spol); };
log { source(s_sys); filter(f_boot); destination(d_boot); };
log { source(s_sys); filter(f_cron); destination(d_cron); };
[root at test-syslog-ng ~]#
Regards,
--
Jakub Jankowski|shasta at toxcorp.com|http://toxcorp.com/
GPG: FCBF F03D 9ADB B768 8B92 BB52 0341 9037 A875 942D
More information about the syslog-ng
mailing list