Syslog plugin issues

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
euriska
Posts: 4
Joined: Thu Aug 17, 2006 9:31 am

Syslog plugin issues

Post by euriska »

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
ddonohue
Cacti User
Posts: 77
Joined: Mon Jul 10, 2006 10:36 am
Contact:

Post by ddonohue »

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));
};
euriska
Posts: 4
Joined: Thu Aug 17, 2006 9:31 am

No change

Post by euriska »

Still nothing in pipe file.
euriska
Posts: 4
Joined: Thu Aug 17, 2006 9:31 am

Well it fixed itselft

Post by euriska »

It magically started working
User avatar
nahun
Cacti User
Posts: 92
Joined: Wed Feb 15, 2006 11:27 pm
Location: Idaho
Contact:

Post by nahun »

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]
pxk
Posts: 15
Joined: Sun Sep 10, 2006 11:19 pm

Re: Syslog plugin issues

Post by pxk »

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
I too am having trouble getting anything to the pipe. I don't have a password, so my script looks like this:

#! /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.
sini
Cacti User
Posts: 91
Joined: Mon Nov 24, 2003 10:22 am
Location: Hungary

Post by sini »

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
Sini
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests