[syslog-ng] syslog-ng sending to pipe

shaun.hofer at altcall.com shaun.hofer at altcall.com
Wed Oct 5 12:57:00 CEST 2005


Hi all

Syslog-ng is set to write to a pipe. Syslog-ng starts very early on in the
boot process, nothing is reading from the pipe yet. Later on, mysql script
starts reading from the pipe, but by that time, it seems as though syslog
isn't bothering to write to the pipe anymore. 'ps axf' shows this for the
mysql init script:
'2023 /etc/init.d/sqlsyslogd start'
The mysql init script thinks the pipe is blocked. If you restart syslog-ng
at this point the mysql script starts reading from the pipe. Do you have
any ideas as to how to get this working?

Heres the script:
case "$1" in
start)
        # If the pipe does not exist, create it
        if [ ! -e /tmp/mysql.pipe ] ; then
                mkfifo /tmp/mysql.pipe
        fi
        mysql -u sys --password=xxxx syslog< /tmp/mysql.pipe &
;;
stop )
        if [ -e /tmp/mysql.pipe ]; then
                rm -f /tmp/mysql.pipe
        fi
;;
*)
        echo "Usage: sqlsyslogd {start|stop}"
        exit 1;
esac
exit 0;

>From the syslog-ng.conf:
destination d_mysql {
  pipe("/tmp/mysql.pipe" template("INSERT INTO logs (host, facility,
priority, level, tag, date, time, program, msg) VALUES
( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL','$TAG','$YEAR-$MONTH-$DAY',
'$HOUR:$MIN:$SEC', '$PROGRAM', '$MSG' );\n") templ
ate-escape(yes));
};
log {
        source(s_all);
        source(tcpgateway);
        destination(d_mysql);
};

Thanks in advance
Shaun



More information about the syslog-ng mailing list