[syslog-ng] syslog-ng to MySQL: write decimal code of severity level in column

Tadej Bregar tadej.bregar at smart-com.si
Fri Nov 10 14:54:51 CET 2006


I'm using syslog-ng 2.0 rc4 with Php-Syslog-NG 2.9.2a on RHEL4 with
MySQL 5.0.24a.

I'm feeding MySQL server through UNIX pipe and everything goes well -
BUT I've got a few questions.


This is not strictly syslog-ng problem, as I'm also using php-syslog-ng
in my setup (php-syslog-ng database schema for MySQL), but I'll ask here
on this list anyway:


1.How can I configure syslog-ng to write decimal code of severity (see
RFC3164) in column "level" (or "priority") of table "logs" in database
"syslog"? Is this possible to achieve somehow?


2. Why are we logging the same information twice (the same data gets
written in column "priority" and "level")?


The ideal setup would be to write decimal code of severity level in
column "level" and corresponding word string (eg. info or warning or
crit ...) in column "priority".

Using php-syslog-ng in this case, we could order syslog messages by
priority properly (sql query ... ORDER BY level ASC .... orders our
messages by alphabetical order)  

Now we can't (!!) because in ascending mode we get alert (character A)
first and warning (character W) last, but we should get nice progression
like: debug, info, notice, warning, error, crit, alert, emerg. 


Just in case, I'm attaching a part of syslog-ng.conf file:


destination d_mysql {


      template("INSERT INTO logs

      (host, facility, priority, level, tag, datetime, program, msg)


      '$PROGRAM', '$MSG' );\n") template-escape(yes));





Thanks for any info,



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.balabit.hu/pipermail/syslog-ng/attachments/20061110/8442065e/attachment.htm

More information about the syslog-ng mailing list