[syslog-ng] Splitting a single source to multiple mysql tables

Dukes Clayton Clayton.Dukes at HCAhealthcare.com
Tue Mar 7 23:59:47 CET 2006


I think this fixed it, can someone confirm?
 
destination d_mysql { pipe("/var/log/mysql.pipe" template("INSERT INTO
logs
 (host, facility, priority, level, datetime, msg)
 VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL',
'$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC','$MSG' );\n")
 INSERT INTO host
 (host)
 VALUES ( '$HOST' ) ON DUPLICATE KEY UPDATE count=count+1;\n")
 INSERT IGNORE INTO facility
 (facility)
 VALUES ( '$FACILITY' );\n")
 template-escape(yes)); };
 
 log { source(net); destination(d_mysql); };
 

________________________________

From: syslog-ng-bounces at lists.balabit.hu
[mailto:syslog-ng-bounces at lists.balabit.hu] On Behalf Of Dukes Clayton
Sent: Tuesday, March 07, 2006 4:43 PM
To: syslog-ng at lists.balabit.hu
Subject: [syslog-ng] Splitting a single source to multiple mysql tables



Hiya, 
Here's what I have, why doesn't it work? 


destination d_mysql { pipe("/var/log/mysql.pipe" template("INSERT INTO
logs 
 (host, facility, priority, level, datetime, msg) 
 VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL',
'$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC','$MSG' );\n") template-esc 

destination d_host { pipe("/var/log/mysql.pipe" template("INSERT INTO
host 
 (host) 
VALUES ( '$HOST' ) ON DUPLICATE KEY UPDATE count=count+1;\n")
template-escape(yes)); }; 
  
destination d_mysql_facility { pipe("/var/log/mysql.pipe"
template("INSERT IGNORE INTO facility 
 (facility) 
VALUES ( '$FACILITY' );\n") template-escape(yes)); }; 

# This doesn't work 
#log { source(net); destination(d_mysql); destination(d_host);
destination(d_mysql_facility); }; 

# This works 
 log { source(net); destination(d_mysql); }; 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.balabit.hu/pipermail/syslog-ng/attachments/20060307/75ac8039/attachment.html


More information about the syslog-ng mailing list