You are not logged in.

#1 2009-09-03 01:19:55

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

[SOLVED] MySQL log to syslog

This is driving me insane -- yet another reason I hate MySQL. It's a simple "uncomment these lines in postgresql.conf" for PG, but MySQL has to be so damn cryptic and backwards with everything!
/rant

I can't for the life of me get MySQL to log to syslog in any kind of sane way. From looking at the docs, I need to start mysqld_safe with the --syslog option:
1) I can't modify the /etc/rc.d/mysqld script because that will get overwritten during upgrade
2) There's no options in /etc/conf.d/mysqld to pass an OPTS variable to mysqld_safe
3) I've tried adding 'syslog' to /etc/my.cnf which makes it log to syslog, but then it borks out saying that it's an unknown option!

root@bilby /srv/mysql # /usr/bin/mysqld_safe --datadir=/srv/mysql/
090903 11:29:25 mysqld_safe Logging to syslog.
090903 11:29:26 mysqld_safe Starting mysqld daemon with databases from /srv/mysql/
090903 11:29:28 mysqld_safe mysqld from pid file /srv/mysql//bilby.falconn.nl.pid ended
root@bilby /srv/mysql # grep unknown /var/log/everything.log
090903 11:05:58 [ERROR] /usr/sbin/mysqld: unknown option '--syslog'

Any ideas, I know this is going to one of those "it's simple, do this" questions, but I can't figure it out, and everything on Google just wants to tell me how to log syslog to mysql, instead of mysql to syslog.

Last edited by fukawi2 (2009-09-03 01:41:36)

Offline

#2 2009-09-03 01:35:08

drtoki
Member
From: {x ∈ A | p(x) = 1}
Registered: 2009-07-22
Posts: 95

Re: [SOLVED] MySQL log to syslog

I'm not certain about this, but as I recall MySQL can't write directly to syslog due to security concerns.  I suppose you could pipe it through logger if you wanted to though

Offline

#3 2009-09-03 01:41:23

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] MySQL log to syslog

Since 5.1.20 it can... I've got it working now, it needed another section in /etc/my.cnf

[mysqld_safe]
syslog

So the 'syslog' option goes under there, instead on under [mysqld] section.

I'll open another topic for my next problem...

Offline

Board footer

Powered by FluxBB