sylog-ng3 & syslog plugin

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
User avatar
zgamer
Cacti User
Posts: 86
Joined: Sat Sep 23, 2006 7:50 pm
Location: WI, USA

sylog-ng3 & syslog plugin

Post by zgamer »

I'm in the process of setting up the syslog plugin of which the installation went fine with the exception of the database importing. I installed syslog_ng3

Code: Select all

syslog-ng -V
syslog-ng 3.1.1
Installer-Version: 3.1.1
Revision: ssh+git://bazsi@git.balabit//var/scm/git/syslog-ng/syslog-ng-ose--mainline--3.1#master#8747d74491eac3fdf5052194f47a68e659633ca9
Compile-Date: Sep 15 2010 10:22:40
Enable-Threads: on
Enable-Debug: off
Enable-GProf: off
Enable-Memtrace: off
Enable-Sun-STREAMS: off
Enable-Sun-Door: off
Enable-IPv6: on
Enable-Spoof-Source: on
Enable-TCP-Wrapper: on
Enable-SSL: on
Enable-SQL: on
Enable-Linux-Caps: off
Enable-Pcre: on
With the following config for syslog-ng

Code: Select all

@version:3.0

options {
        stats_freq(3600);
        keep_hostname(yes);
        flush_lines(16);
        log_fifo_size(16384);
};

source src {
        unix-dgram("/usr/local/cacti/log/syslog.log");
        internal();
};
source net {
        udp();
};

destination d_mysql {
    sql(type(mysql)
        host("127.0.0.1") username("some_user") password("some_pass")
        database("cacti")
        table("syslog_incoming")
        columns("facility varchar(10)", "priority varchar(10)", "date date", "time time", "host varchar(128)", "message varchar(1024)")
        values("$FACILITY", "$PRIORITY", "$R_DATE", "$R_DATE", "$HOST", "$MSGONLY")
       );
};

log { source(net); destination(d_mysql); };
I'm seeing the syslog-ng processing running and syslog entries hitting the server but not seeing anything showing up in the syslog_incoming table. Any ideas?
Current cacti install
-------------------------
Hardware: ESXi 5.1 VM
Software Load: FreeBSD 9.0 + Lighttpd + MySQL + Cacti 0.8.7
Plug-ins loaded: aggregate, flowview, monitor, realtime, rrdclean, syslog, spikekill, settings, thold, weathermap, and uptime.
User avatar
smlick
Cacti User
Posts: 267
Joined: Tue May 20, 2008 4:09 am
Location: Italy, Rome

Post by smlick »

This is my working config:

## Log to Mysql for Php-syslog-ng
source s_everything { internal(); pipe("/proc/kmsg");
unix-stream("/dev/log"); udp(); };

destination d_mysql {
program("/usr/bin/mysql -hhostaddress -uyouruser -pyourpassword syslog_ng"
template("INSERT INTO plugin_camm_syslog (host, sourceip, facility, priority, sys_date, message, status)
VALUES ( '$HOST', '$SOURCEIP', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$MSG', '0' );\n")
template-escape(yes));
};

log {
source(s_everything);
destination(d_mysql);
};


Regards
Alessio
Cacti Version 0.8.8c production / 0.8.8c test W2008 -- Plugin:Weathermap - Monitor - CAMM 1.6.7 :) - Nectar - GPS Map
User avatar
zgamer
Cacti User
Posts: 86
Joined: Sat Sep 23, 2006 7:50 pm
Location: WI, USA

Post by zgamer »

the source only works under linux, trying this on a freebsd install.

Code: Select all

        internal();
        file("/dev/klog");
        unix-stream("/var/run/log");
        unix-stream("/var/run/logpriv" perm(0600));
        udp();
launches without any errors but still not seeing anything the syslog_incoming table
Current cacti install
-------------------------
Hardware: ESXi 5.1 VM
Software Load: FreeBSD 9.0 + Lighttpd + MySQL + Cacti 0.8.7
Plug-ins loaded: aggregate, flowview, monitor, realtime, rrdclean, syslog, spikekill, settings, thold, weathermap, and uptime.
User avatar
zgamer
Cacti User
Posts: 86
Joined: Sat Sep 23, 2006 7:50 pm
Location: WI, USA

Post by zgamer »

Eventually got it, under freebsd the mysql client is under /usr/local/bin/mysql, sourceip is not used with the syslog plug-in, and sys_date is just date with the syslog plug-in.
Current cacti install
-------------------------
Hardware: ESXi 5.1 VM
Software Load: FreeBSD 9.0 + Lighttpd + MySQL + Cacti 0.8.7
Plug-ins loaded: aggregate, flowview, monitor, realtime, rrdclean, syslog, spikekill, settings, thold, weathermap, and uptime.
User avatar
TheWitness
Developer
Posts: 17064
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

How do you like the face lift from the old version?
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
zgamer
Cacti User
Posts: 86
Joined: Sat Sep 23, 2006 7:50 pm
Location: WI, USA

Post by zgamer »

TheWitness wrote:How do you like the face lift from the old version?
Native DB support is a big plus with syslog_ng v3, otherwise not much different than the v2 codebase.

Here's the completed syslog_ng.conf for FreeBSD

Code: Select all

@version: 3.0

source s_everything {
        unix-dgram("/var/run/log");
        unix-dgram("/var/run/logpriv" perm(0600));
        file("/dev/klog");
        internal();
        udp();
};

destination d_mysql {
program("/usr/local/bin/mysql -hlocalhost -umyuser --pmypass cacti"
template("INSERT INTO syslog_incoming (host, facility, priority, date, time, message, status)
VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$MSG', '0' );\n")
template-escape(yes));
};

log {
source(s_everything);
destination(d_mysql);
};
Current cacti install
-------------------------
Hardware: ESXi 5.1 VM
Software Load: FreeBSD 9.0 + Lighttpd + MySQL + Cacti 0.8.7
Plug-ins loaded: aggregate, flowview, monitor, realtime, rrdclean, syslog, spikekill, settings, thold, weathermap, and uptime.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests