snippetsqlModerate
How do I output MySQL logs to syslog?
Viewed 0 times
sysloglogsoutputmysqlhow
Problem
I want to use syslog for logging MySQL(5.1.41) on Ubuntu(10.04 LTS).
I found information that output error log to syslog.
But I want to use syslog for logging general logs and slow query logs.
Please advise me how to write config file?
I could not find how to do that in the reference manual.
http://dev.mysql.com/doc/refman/5.1/en/log-destinations.html
I found information that output error log to syslog.
[mysqld_safe]
syslogBut I want to use syslog for logging general logs and slow query logs.
Please advise me how to write config file?
I could not find how to do that in the reference manual.
http://dev.mysql.com/doc/refman/5.1/en/log-destinations.html
Solution
This is MUCH more simply done this way:
cd to mysql folders:
in my.cnf tell it:
Then, configure your syslog/syslog-ng to read the FIFO pipe and do with it as it will..
In my case, I pipe it across net to a centralized server with only the error logs and slow query logs however.
In situations where you want to also keep local copy, just set it to output to table and file as described above.
cd to mysql folders:
mkfifo mysql-general.login my.cnf tell it:
[mysqld]
general-log-file = /path/to/mysql/dir/mysql-general.logThen, configure your syslog/syslog-ng to read the FIFO pipe and do with it as it will..
In my case, I pipe it across net to a centralized server with only the error logs and slow query logs however.
In situations where you want to also keep local copy, just set it to output to table and file as described above.
Code Snippets
mkfifo mysql-general.log[mysqld]
general-log-file = /path/to/mysql/dir/mysql-general.logContext
StackExchange Database Administrators Q#3552, answer score: 12
Revisions (0)
No revisions yet.