[syslog-ng] syslog-ng sending to pipe

Mario Gzuk gzuk at bgc-jena.mpg.de
Wed Oct 5 13:34:10 CEST 2005


Hi we use it in this way:

#!/bin/bash
# script: /root/bin/syslog_mysql.sh 
if [ -e /var/log/mysql.pipe ]
        then
        while [ -e /var/log/mysql.pipe ]
                do
                mysql -u x --password=x syslog < /var/log/mysql.pipe
                done
else
        mkfifo /var/log/mysql.pipe
fi

and one entry in crontab:

@reboot root /root/bin/syslog_mysql.sh >> /var/log/mysql.log 2>&1

And there are no problems after an reboot....

greetings

Am Mittwoch, den 05.10.2005, 20:57 +1000 schrieb
shaun.hofer at altcall.com:
> 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
> 
> _______________________________________________
> syslog-ng maillist  -  syslog-ng at lists.balabit.hu
> https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Frequently asked questions at http://www.campin.net/syslog-ng/faq.html
> 
> 
> 
-- 
Mario Gzuk
IT department
Max-Planck-Institute for Biogeochemistry
Beutenberg Campus
Hans-Knoell-Str.  10
07745 Jena
Germany
GNUPG Key: http://www.bgc-jena.mpg.de/~gzuk/gnupg_gzuk.key
Tel: +49(0)3641576703
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.balabit.hu/pipermail/syslog-ng/attachments/20051005/ed71ffce/attachment.pgp


More information about the syslog-ng mailing list