Talk:HOWTO Setup PHP-Syslog-NG
From Gentoo Linux Wiki
Revision Notes 20070313 Scrubbed most of this page since the HOWTO has changed alot
Contents |
[edit] Neater looking config that didnt work for me
from my /etc/syslog-ng/syslog-ng.conf
| File: syslog-ng.conf |
## Log syslog-ng to mysql database
##
destination d_mysql {
program("/usr/bin/mysql -f --disable-pager -B --reconnect -w -D syslog --user=XXX --password=XXX"
template("INSERT INTO logs (host, facility, priority, level, tag, date, time, program, msg) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$PROGRAM', '$MSG' );\n")
template-escape(yes));
};
log {
source(s_sys);
destination(d_mysql);
};
|
Just Try this one. Errors go to Logfile /var/log/db_log.log. There you can see, why it doesn't work. Here in several installations it works just fine!
| File: syslog-ng.conf |
## Log syslog-ng to mysql database
##
destination d_mysql {
program("/usr/bin/mysql --reconnect -f -T --user=xxx --password=yyy syslog >> /var/log/db_log.log 2>&1"
template("INSERT INTO logs (host, facility, priority, level, tag, date, time, program, msg) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$PROGRAM', '$MSG' );\n")
template-escape(yes));
};
log {
source(s_sys);
destination(d_mysql);
};
|
[edit] polish character conversion is not needed anymore
The funny representation of non-ASCII characters was a bug in syslog-ng and has been fixed in syslog-ng 2.0.4.
[edit] security
With the sql auth info in the config, you should ensure it's 640, I beleive syslog-ng.conf is 644 by default.
- That was a good suggestion. I added some additional steps and applied it to the other files as well.
- --Titan 14:45, 31 March 2008 (UTC)
[edit] Many thanks!
I have been writing a very similar article over on the [www.freebsdwiki.net FreeBSD Wiki] site and have had endless problems resolving the Syslog-NG to MySQL pipe issue. I looked at your direct-to-the-binary method of using MySQL and that's fixed it beautifully! Hope you don't mind me cribbing your method for the benefit of those in the FreeBSD camp?
Here's the FreeBSD Syslog-NG article.
Many thanks,
