On Wed, 18 Feb 2015, Boqvist Martin wrote:

I'm using rsyslog 7.4.7 on RHEL 7 and have an issue creating a filter for mysql 
logging.

What I want to achieve is to have a remote hosts in certain networks logging to 
mysql.
I'm using the syslog viewer plugin with cacti and need to have a custom 
template applied.

Here is the configuration that I've tried so far but I do not get any log 
entries in the database.

template (
       name="cacti_syslog" type="string" option.sql="on"
       string=""INSERT INTO syslog_incoming(facility, priority, date, time, host, 
message) values (%syslogfacility%, %syslogpriority%, '%timereported:::date-mysql%', 
'timereported:::date-mysql%', '%HOSTNAME%', '%msg%')"
)

if (
       $fromhost-ip startswith '192.168' or
       $fromhost-ip startswith '10.4'
) then
       action (
               type="ommysql" server="localhost" db="cacti" uid="cacti" 
pwd="cactipassword" template="cacti_syslog")
      )

& stop

the first thing is to figure out if the filter is working properly, replace the write to the database with a write to a file.

If that works, then troubleshoot the database insert, check the mysql logs or run rsyslog in debug mode to see what error you get back from the datase (if you have to tweak the filter, it may 'just work' afterwords.

David Lang
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to