options { sync (0);
time_reopen (10);
log_fifo_size (1000);
long_hostnames (off);
use_dns (yes);
use_fqdn (yes);
create_dirs (yes);
keep_hostname (yes);
};
source s_net { udp(ip(0.0.0.0) port(514)); };
destination d_mysql { pipe("/tmp/mysql.pipe" template("INSERT INTO logs (host, f
acility, priority, level, tag, date, time, program, msg) VALUES ('$HOST', '$FACI
LITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$
PROGRAM', '$MSG');\n") template-escape(yes));
};
log { source(s_net); destination(d_mysql); };
Here is the script used to pipe /tmp/mysql.pipe into databse:
#!/bin/bash
if [ -e /tmp/mysql.pipe ]; then
while [ -e /tmp/mysql.pipe ]
do
mysql -u syslog --password=password syslog < /tmp/mysql.pipe
done
else
mkfifo /tmp/mysql.pipe
fi
I have confirmed that I can redirect echo to the pipe, so I know the pipe is working. I've even chmod 777 the pipe. I have also confirmed that log messages are coming in over the network using tcpdump and when I use syslog-ng to log to file, it works just fine. Why doesn't syslog-ng output to the pipe, argh!? Any help would be greatly appreciated.
Matt