[syslog-ng]MYSQL pipe

Steven S syslog-ng@lists.balabit.hu
Mon, 3 Jan 2005 10:56:06 -0500


This snippet of /etc/rc.local from a 3.5 box is far from perfect...  You
should run the 'mysqld_safe' script to start mysql.  Also see the discussion
on openbsd-misc about increasing open-files. 
http://marc.theaimsgroup.com/?l=openbsd-misc&w=2&r=1&s=mysql+solved&q=b


-----/etc/rc.local snippet------------------------------------
rm -f /var/www/tmp/mysql.sock
if [ -x /usr/local/libexec/mysqld ]; then
        echo -n ' mysqld';      /usr/local/bin/mysqld_safe &
        sleep 10;
fi
if [ -S /var/run/mysql/mysql.sock ]; then
        ln /var/run/mysql/mysql.sock /var/www/tmp/mysql.sock
else
        echo -n '...waiting for mysqld'
        sleep 10;
        ln /var/run/mysql/mysql.sock /var/www/tmp/mysql.sock
fi

if [ -x /usr/local/sbin/syslog2db -a -S /var/run/mysql/mysql.sock ]; then
        echo -n ' syslog2db';   /usr/local/sbin/syslog2db
>>/var/log/syslogdb &
fi


-Steve S.

-----Original Message-----
From: syslog-ng-admin@lists.balabit.hu
[mailto:syslog-ng-admin@lists.balabit.hu] On Behalf Of
Robert.COward@deploymenthealth.osd.mil
Sent: Monday, January 03, 2005 8:48 AM
To: syslog-ng@lists.balabit.hu
Subject: [syslog-ng]MYSQL pipe





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

_______________________________________________
syslog-ng maillist  -  syslog-ng@lists.balabit.hu
https://lists.balabit.hu/mailman/listinfo/syslog-ng
Frequently asked questions at http://www.campin.net/syslog-ng/faq.html