[syslog-ng] Trouble with logging to mysql

Stallmann, Andreas AStallmann at CONET.DE
Fri Sep 5 15:12:08 CEST 2008


Hi there,

I'm trying to let syslog-ng log to a mysql database, which is somehow
not working (anymore).

All my network traffic is supposed to be written into a separate logfile
as well as into a mysql database. I followed the HowTo on
http://gentoo-wiki.com/HOWTO_setup_PHP-Syslog-NG#Syslog-ng_INIT_Script,
and altered the configuration to fit my needs. Here it comes:

############################################
source net {
	udp(ip("0.0.0.0") port(514));
};

destination d_mysql {
  program("/usr/bin/mysql --reconnect -f -T --user=syslogfeeder
--password=PASSWORD syslog >> /var/log/db_log.log 2>&1" 
  template("INSERT INTO logs (host, facility, priority, level, tag,
datetime, program, msg) VALUES ( '$HOST', '$FACILITY', '$PRIORITY',
'$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC','$PROGRAM', '$MSG'
);\n") template-escape(yes));
};

destination netmessages { file("/var/log/net.log"); };

log { source(net); destination(netmessages); };
log { source(net); destination(d_mysql); };
##############################################

Thing is, logging to the file works nicely. Logging to the database
worked up to some date, but since a while (and no one knows exactly
since when, because nobody had a look at the database for some time) it
doesn't. This might be connected with a system update. I can provide you
with information on the versions (the OS is SLES 10.0, all packages come
from the standard source; no self-compiled packages installed) of syslog
and mysql as soon as I have access to the customers machine again.

I'm looking for a sensible way to debug syslog. Running syslog-ng in the
foreground didn't help, I can't see any messages related to logging to
mysql. It seems that the destination is never touched.

Isn't it possible to log on source to two destinations (anymore)? (I
think commented out logging to netmessages, but it still didn't work.)

Any comments and hints will be helpful. Even RTFM if you point me to a
comprehendible one. :-)

TNX,

Andreas 

-- 
CONET Solutions GmbH
Andreas Stallmann, Senior Berater
Theodor-Heuss-Allee 19, 53773 Hennef
Tel.: +49 2242-939-677, Fax: +49 2242-939-393
Internet: http://www.conet.de, mailto: astallmann at conet.de


-----------------------------------
CONET Solutions GmbH, Theodor-Heuss-Allee 19, 53773 Hennef
Registergericht/Registration Court: Amtsgericht Siegburg (HRB Nr. 9136)
Geschaftsfuhrer/Managing Directors: Dipl.-Inform. Rudiger Zeyen (Sprecher/Chairman), 
Dipl.-Betriebsw. Wilfried Putz und Dipl.-Inform. Jurgen Zender 
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: Dipl.-Math. Hans-Jurgen Niemeier



More information about the syslog-ng mailing list