Bug #59454 Error Logging to Syslog and tagging
Submitted: 12 Jan 2011 17:57 Modified: 12 Feb 2011 23:56
Reporter: Peter Ertel Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.1.46 OS:Linux
Assigned to: CPU Architecture:Any

[12 Jan 2011 17:57] Peter Ertel
Description:
The syslog protocol does not contain any tag, not even the one specified in my.cnf (or via command line invocation).

http://dev.mysql.com/doc/refman/5.1/en/error-log.html states:

"For logging to syslog, messages from mysqld_safe and mysqld are written with a tag of mysqld_safe and mysqld, respectively. As of MySQL 5.1.21, to specify a suffix for the tag, use --syslog-tag=tag, which modifies the tags to be mysqld_safe-tag and mysqld-tag."

but this is not correct as neither is the tag passed on to mysqld nor does the binary present any argument to accept such a value.

A word on severity: Any WARN message (or worse) on our systems is send via email for immediate inspection. It is therefore important to reduce the message output to a proper value and syslog filtering is the only viable solution so far. A missfunctioning logging system as with mysqld is very displeasing.

How to repeat:
In your my.cnf:

[safe_mysqld]
# comment out any log-error entry
syslog
syslog-tag = some_tag

In your syslog file (these are actually from mysqld as mysqld_safe isn't reporting to syslog at all but stdout):
20110112 18:11:00 servername daemon err
20110112 18:11:00 servername daemon err 110112 18:11:00 [Note] Plugin 'ndbcluster' is disabled.
20110112 18:11:00 servername daemon err 110112 18:11:00 [Note] Plugin 'FEDERATED' is disabled.
20110112 18:11:01 servername daemon err 110112 18:11:01  InnoDB: Started; log sequence number 293 4071952634
20110112 18:11:01 servername daemon err 110112 18:11:01 [Note] Event Scheduler: Loaded 0 events
20110112 18:11:01 servername daemon err 110112 18:11:01 [Note] /usr/sbin/mysqld: ready for connections.
20110112 18:11:01 servername daemon err Version: '5.1.46'  socket: '/var/run/mysql/mysql.sock'  port: 3306  SUSE MySQL RPM

Suggested fix:
1. Fix the severities! None of the default message are of type ERROR!
2. Supply any syslog tag that allows one to apply syslog filters or just give us the option as described in error-log.html.
3. Make the syslog facility configurable.
[12 Jan 2011 18:12] Peter Ertel
Its a logging issue.
[12 Jan 2011 23:54] MySQL Verification Team
I have successfully used syslog and syslog-tag from both the configuration file and command line options on Mac OS X as seen below:

bash-3.2# tail /var/log/system.log
Jan 13 10:48:22 macbook mysqld-tag2[16637]: 110113 10:48:22 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.1.47-osx10.5-x86/data/ is case insensitive
Jan 13 10:48:22 macbook mysqld-tag2[16637]: 110113 10:48:22 [Note] Plugin 'FEDERATED' is disabled.
Jan 13 10:48:22 macbook mysqld-tag2[16637]: InnoDB: The InnoDB memory heap is disabled
Jan 13 10:48:22 macbook mysqld-tag2[16637]: InnoDB: Mutexes and rw_locks use InnoDB's own implementation
Jan 13 10:48:22 macbook mysqld-tag2[16637]: InnoDB: Compressed tables use zlib 1.2.3
Jan 13 10:48:22 macbook mysqld-tag2[16637]: 110113 10:48:22  InnoDB: highest supported file format is Barracuda.
Jan 13 10:48:22 macbook mysqld-tag2[16637]: 110113 10:48:22 InnoDB Plugin 1.0.8 started; log sequence number 31870739
Jan 13 10:48:22 macbook mysqld-tag2[16637]: 110113 10:48:22 [Note] Event Scheduler: Loaded 0 events
Jan 13 10:48:22 macbook mysqld-tag2[16637]: 110113 10:48:22 [Note] /usr/local/mysql-5.1.47-osx10.5-x86/bin/mysqld: ready for connections.
Jan 13 10:48:22 macbook mysqld-tag2[16637]: Version: '5.1.47'  socket: '/tmp/mysql2.sock'  port: 3306  MySQL Community Server (GPL)

I used the following settings:

[mysqld_safe]
syslog
syslog-tag=tag2

it also worked from the command line using --syslog --syslog-tag=tag2 options as well.

Do you see this logging issue in any version other than 5.1.46 under SuSE Linux?
[13 Feb 2011 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".