Using syslog-ng on Suse 10 having some issues getting my pipe to work to mysql. I have installed the plugin arch and am using v0.4 of the syslog plugin. I had to create the database manually using the syslog.sql script. The questions I have are the variable names correct for the database. Data is not getting written to the pipe but it does write to a logfile. If I delete the pipe the script will create a new one.
Syslog-ng.conf
destination named_pipe {
pipe("/var/log/mysql.pipe"
template("INSERT INTO syslog (facility, priority, date, time, host, message, seq)
VALUES ( '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$HOST', '$MESSAGE', '$SEQ');\n") template-escape(yes));
};
log { source(src); destination(named_pipe); };
my script
#!/bin/bash
if [ -e /var/log/mysql.pipe ]; then
while [ -e /var/log/mysql.pipe ]
do
mysql -u cactiuser --password=password syslog < /var/log/mysql.pipe
done
else
mkfifo /var/log/mysql.pipe
fi
#!/bin/bash
Syslog plugin issues
Moderators: Developers, Moderators
i'm on Suse 10 as well, this is what my syslog-ng looked like
destination d_mysql {
program("/usr/bin/mysql -u <username> --password=<password> syslog < /var/log/mysql.pipe");
pipe("/var/log/mysql.pipe"
template("INSERT INTO syslog_incoming (facility, priority , date , time , host , message , seq , status ) VALUES ('$FACILITY','$PRIORITY','$YEAR-$MONTH-$DAY','$HOUR:$MIN:$SEC','$HOST', '$MESSAGE','$SEQ','$STATUS') ;\n") template-escape(yes));
};
destination d_mysql {
program("/usr/bin/mysql -u <username> --password=<password> syslog < /var/log/mysql.pipe");
pipe("/var/log/mysql.pipe"
template("INSERT INTO syslog_incoming (facility, priority , date , time , host , message , seq , status ) VALUES ('$FACILITY','$PRIORITY','$YEAR-$MONTH-$DAY','$HOUR:$MIN:$SEC','$HOST', '$MESSAGE','$SEQ','$STATUS') ;\n") template-escape(yes));
};
Well it fixed itselft
It magically started working
haha, ya thats happened to me. What I did realize recently is that I have to start the script first before syslog-ng. Or just restart syslog-ng after I start the script. The pipe needs to be created before syslog-ng is up I guess.
[size=75]Solaris 10 x86 [color=red][b]||[/b][/color] Cacti - 0.8.7 [color=red][b]||[/b][/color] MySQL - 5.0.45 [color=red][b]||[/b][/color] PHP - 5.2.6 [color=red][b]||[/b][/color] RRDTool - 1.2.23 [color=red][b]||[/b][/color] NET-SNMP - 5.4.1 [color=red][b]||[/b][/color] Syslog-ng 2.0.5
[url=http://www.indigo-networks.com]indigo-networks.com[/url][/size]
[url=http://www.indigo-networks.com]indigo-networks.com[/url][/size]
Re: Syslog plugin issues
I too am having trouble getting anything to the pipe. I don't have a password, so my script looks like this:euriska wrote:Using syslog-ng on Suse 10 having some issues getting my pipe to work to mysql. I have installed the plugin arch and am using v0.4 of the syslog plugin. I had to create the database manually using the syslog.sql script. The questions I have are the variable names correct for the database. Data is not getting written to the pipe but it does write to a logfile. If I delete the pipe the script will create a new one.
Syslog-ng.conf
destination named_pipe {
pipe("/var/log/mysql.pipe"
template("INSERT INTO syslog (facility, priority, date, time, host, message, seq)
VALUES ( '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$HOST', '$MESSAGE', '$SEQ');\n") template-escape(yes));
};
log { source(src); destination(named_pipe); };
my script
#!/bin/bash
if [ -e /var/log/mysql.pipe ]; then
while [ -e /var/log/mysql.pipe ]
do
mysql -u cactiuser --password=password syslog < /var/log/mysql.pipe
done
else
mkfifo /var/log/mysql.pipe
fi
#!/bin/bash
#! /usr/local/bin/bash
if [ -e /var/log/mysql.pipe ]; then
while [ -e /var/log/mysql.pipe ]
do
/usr/local/bin/mysql -u root syslog < /var/log/mysql.pipe
done
else
mkfifo /var/log/mysql.pipe
fi
If that looks ok, can anyone offer anything else to check.
Hi,
Did you specify the source for the log? As I only see your destination.
My syslog-ng looks like this:
#pipe messages to /var/log/mysql.pipe to be processed by mysql
source src {unix-stream("/dev/log");
pipe("/proc/kmsg");
internal();};
destination d_mysql { pipe("/var/log/mysql.pipe" template("INSERT INTO logs (host, facility, priority, level, tag, date, time, program, msg) VALUES ( '$HOST'
, '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC','$PROGRAM', '$MSG' );\n") template-escape(yes)); };
log { source(src); destination(d_mysql); };
regards
Did you specify the source for the log? As I only see your destination.
My syslog-ng looks like this:
#pipe messages to /var/log/mysql.pipe to be processed by mysql
source src {unix-stream("/dev/log");
pipe("/proc/kmsg");
internal();};
destination d_mysql { pipe("/var/log/mysql.pipe" template("INSERT INTO logs (host, facility, priority, level, tag, date, time, program, msg) VALUES ( '$HOST'
, '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC','$PROGRAM', '$MSG' );\n") template-escape(yes)); };
log { source(src); destination(d_mysql); };
regards
Sini
Who is online
Users browsing this forum: No registered users and 0 guests