mysqld and multilog

Laurent Bercot <[email protected]>
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
 Hello list,

 I am forced to install a MySQL server. (Don't ask.) Being a long-time
extreme daemontools fan, I want to set it up under daemontools.
Supervising mysqld wasn't a problem: the MySQL installation comes with
kind of a supervision shell script, mysqld_safe, and I just had to
scrap that out and put mysqld in a run file. Works perfectly.

 The trouble comes from mysqld's way of logging. mysqld output logs in
*two* ways:
 - an "error" stream, printed on mysqld's stderr, and usually caught by a
"logger" process and written to the /var/log/mysql.err regular file.
 - a "log" stream, usually written to the /var/log/mysql.log regular file;
the name of the file can be changed via mysqld's "--log" option.

 The "error" stream hardly causes any trouble: it's mysqld's stderr, so
it's caught by svscan's pipe and smoothly goes into the adequate
supervised multilog process. But the "log" stream is a pain: how can I
pipe it into a multilog process instead of using a regular file?
Here is what I tried:

 --log=/dev/fd/1
 "Could not use /dev/fd/1 for logging (error 13)."
 13 means EACCES.
 I don't understand why it doesn't work, but it doesn't work.

 --log=/service/mysqld/logfifo with a multilog process reading from
the fifo - the standard trick.
 "Could not use /service/mysqld/logfifo for logging (error 29)."
 29 means ESPIPE.
 Aaugh ! Dorks. Why on earth do they need to seek on that descriptor?

 I'm out of ideas. Do I have to let mysqld write its logs into a regular
file, and use logrotate or any other unreliable way of rotating logs?
Or is there a way to get past that horrible ESPIPE and have a reliable
installation? Google "mysqld daemontools" doesn't help much. I have
found Brian Reichert's run file for mysqld, but it uses --log=/some/fifo
which doesn't appear to work in my case.

 Thanks in advance !

 [ Debian GNU/Linux, latest "unstable" version (never had it crash though);
kernel 2.6.9; and I'm using the Debian mysql-server package, which is

# mysqld --version
mysqld  Ver 4.0.22-log for pc-linux on i386 (Source distribution)

 I don't know where that "-log" comes from or whether it's special. ]

-- 
 Ska
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.