[syslog-ng]MYSQL pipe 2

syslog-ng@lists.balabit.hu syslog-ng@lists.balabit.hu
Wed, 5 Jan 2005 09:14:38 -0500





Steven,

Thanks for the quick response. here is what my mysql entry looks like in
/etc/rc.local:

# MYSQL
if [ X"${mysql}" == X"YES" ]; then
        if [ -x /usr/local/bin/mysqld_safe ]; then
                echo -n " mysql";       /usr/local/bin/mysqld_safe
--socket=/var/www/var/run/mysql/mysql.sock &
                sleep 10
                echo -n " syslog-ng2mysql";
/etc/check_syslog-ng2mysql.sh &
        fi
fi

and here is the /etc/check_syslog-ng2mysql.sh script i sent in yesterday:

#!/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 don't think the problem is that mysqld is not started when i issue the
mysql command in the script. I think it has something to do with how
openbsd starts daemons
from within /etc/rc.local and /etc/rc. When i reboot this server, the
/etc/check_syslog-ng2mysql.sh does nto start at all.
Basically I am just looking for other ways to start
/etc/check_syslog-ng2mysql.sh or more to the point the "mysql -u root
--password=password syslog < /tmp/mysql.pipe" line
which just dumps the data from a named pipe created by syslog-ng, over to
the mysql db. Thanks for all the help.

---
5 January 2005
"We must learn to welcome and not to fear the voices of dissent. We must
dare to think about "unthinkable things" because when things become
unthinkable, thinking stops and action becomes mindless." (J. William
Fulbright, 1905-1995)
---
Robert V. Coward
UNIX System Administrator
Computer Science Corporation