Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

By default, Debian uses rsyslog to handle MySQL error logging. I like this behavior and do not want to change it. However, I would like rsyslog to write MySQL events to /var/log/mysqld.log in addition to the already functional /var/log/syslog. I believe this should be doable using rsyslog, so I do not want to use the MySQL --log-error command option.

After reading the my.cnf documentation section on --syslog, it seemed to me that the syslog facilities used would be called mysqld and mysqld_safe. Therefore, I tried adding the following to my rsyslog.conf:

mysqld.*                        -/var/log/mysqld.log
mysqld_safe.*                   -/var/log/mysqld_safe.log

However, nothing gets written to those files after restarting the rsyslog and mysql services. I touched the files and they are owned by root:adm like other similar files like /var/log/mail.log, which properly receives my postfix and dovecot events.

I am inexperienced with rsyslog, so I'm not sure what I'm doing wrong or how to further investigate this. It's made all the harder due to the wealth of information on logging syslog into MySQL, which is not what I am seeking to do. Any help would be appreciated.

Edit: On further investigation, I see that those are not valid facilities (which are predefined). So I therefore need to use an alternate method for filtering rather than by facility.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Adding the following lines to rsyslog.conf seems to produce the result I sought:

:syslogtag, isequal, "mysqld:" -/var/log/mysqld.log
& ~
:syslogtag, isequal, "mysqld_safe:" -/var/log/mysqld.log
& ~
:syslogtag, startswith, "/etc/mysql/debian-start" -/var/log/mysqld.log
& ~
share|improve this answer
    
Since no alternatives have come up in a couple months, I'll accept my own answer. –  Gregyski Dec 6 '11 at 20:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.