[syslog-ng]syslog-ng template does not work
Sirinus
syslog-ng@lists.balabit.hu
Mon, 1 Nov 2004 14:39:21 -0500 (EST)
Hello, Everyone,
I just installed syslog-ng on my mandrake-9.2 with the rpm package:
syslog-ng-1.4.17-3mdk.src.rpm
For generly log, it works fine. However, I would like to forward my logs to MySql database. So I tried to follow the tutorials of Michael Earls ( ohttp://vermeer.org/display_doc.php?doc_id=1). However, after I added the following line to my syslog-ng.conf, each time when I tried to restart syslog-ng, it tells sth is wrong. The following is what I have done:
1. Add the following to my syslog-ng.conf so that I can log to mysql database:
## Log syslog-ng to mysql database
##
destination d_mysql {
pipe("/tmp/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(net); destination(d_mysql);
};
2. stop syslog-ng
[root@localhost tmp]# service syslog-ng stop
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
3. restart syslog-ng
[root@localhost tmp]# service syslog-ng start
Starting system logger: parse error at 27
Parse error reading configuration file, exiting.
[FAILED]
starting kernel logger: [ OK ]
NOTE: line 27 is where "template ("INSERT INTO logs (host, facility, priority, level, tag, " showing the first step.
I wonder to know what's wrong with this configuration? I tried to read the source code. I cannot find any thing related to "template". Does syslog-ng 1.4.17 support "template"? How could I fix the problem?
THanks a lot
Yours
Ch Zhang
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!