use syslog-ng and mysql...setup tables for mysql message

here is the config for syslog-ng

also make sure cccam has DEBUG: yes enabled or else it will not send anything to syslog-ng

destination d_mysql {
pipe("/tmp/mysql.syslog-ng.pipe"
template("INSERT INTO TABLENAME
(datetime, msg) VALUES ('$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC','$MSG' );\n")
template-escape(yes));
};


log { source(s_sys); filter(f_cccam); destination(d_mysql); };

log { source(s_sys); filter(f_cccam); };
filter f_cccam { level(debug); };

-----------------------------------------------------------------------

also create a script and place in /tmp

if [ -e /tmp/mysql.syslog-ng.pipe ]; then
while [ -e /tmp/mysql.syslog-ng.pipe ]
do
mysql -uUSERNAME --password=PASSWORD DBNAME < /tmp/mysql.syslog-ng.pipe
done
else
mkfifo /tmp/mysql.syslog-ng.pipe
fi

then create a cron to run this script every min just incase it screws up