[syslog-ng]MYSQL pipe

syslog-ng@lists.balabit.hu syslog-ng@lists.balabit.hu
Mon, 3 Jan 2005 08:47:37 -0500




I have syslo-ng running fine on OpenBSD 3.6. Logging works properly to
file. I also have MYSQL up and running. I can get a named pipe open and get
MYSQL to pickup the log entries with no problem. However I am at a lost as
to how to start this process at boot up or automatically. If I call the
following script, which works from the command line, from either /etc/rc or
/etc/rc.local the mysql client is never kicked of, and /etc/rc hangs. If I
put the same script into a cron job, cron hangs.

Script:

#!/bin/sh
ps=`ps -ax | grep "\--password=x" | awk '{ print $9 }'`

if [[ $ps != "" ]]; then
        echo "syslog-ng2mysql is alive."
else
        if [ ! -p /tmp/mysql.pipe ]; then
                mkfifo /tmp/mysql.pipe
                kill -HUP `cat /var/run/syslog-ng.pid`
        fi
        mysql -u root --password=password syslog < /tmp/mysql.pipe
fi

I really do not know what is wrong. Can anyone provide examples on their
scripts for starting syslog-ng to named pipe to mysql?


---
3 January 2005
"Hackers make toys. Crackers break them." (Peter Seebach)
---
Robert V. Coward
UNIX System Administrator
Computer Science Corporation