[syslog-ng] syslog-ng sending to pipe

shaun.hofer at altcall.com shaun.hofer at altcall.com
Thu Oct 6 02:15:13 CEST 2005


Thanks for the example.
We tried it, but it seemed to suffer from the same problem of hanging
until we restarted syslog-ng. Any idea's why it takes a restart of
syslog-ng to get any of these scripts running?

Thanks
Shaun

> 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
> _______________________________________________
> 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
>
>




More information about the syslog-ng mailing list