I have installed syslog-ng 3.0.1, open source edition, binary package in RHEL 5.3 system. I'm having trouble to have it writing to MySQL DB using native driver. The current configuration file looks like:
# Write the logs to MySQL DB
destination dd_mysql {
sql(type(mysql)
host("localhost") username("syslogadmin") password("syslogadmin")
database("syslog")
table("logs")
columns("host", "facility", "priority", "level", "tag", "datetime", "program", "msg", "seq")
values("$HOST", "$FACILITY", "$PRIORITY", "$LEVEL", "$TAG", "$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC", "$PROGRAM", "$MSG", "$SEQ")
indexes("seq"));
# program("/usr/bin/mysql -usyslogadmin -psyslogadmin syslog"
# template("INSERT INTO logs (host, facility, priority, level, tag, datetime, program, msg, seq)
# VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$PROGRAM', '$MSG', '$SEQ' );\n")
# template-escape(yes));
};
It works if I use the program driver, as currently commented out.
The table is configured as following, using the schema defined by php-syslog-ng 2.9.8m.
+----------+---------------------+------+-----+---------+----------------+
| Field    | Type                | Null | Key | Default | Extra          |
+----------+---------------------+------+-----+---------+----------------+
| id       | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| host     | varchar(128)        | YES  | MUL | NULL    |                |
| facility | varchar(10)         | YES  | MUL | NULL    |                |
| priority | varchar(10)         | YES  | MUL | NULL    |                |
| level    | varchar(10)         | YES  |     | NULL    |                |
| tag      | varchar(10)         | YES  |     | NULL    |                |
| datetime | datetime            | YES  | MUL | NULL    |                |
| program  | varchar(15)         | YES  | MUL | NULL    |                |
| msg      | text                | YES  |     | NULL    |                |
| seq      | bigint(20) unsigned | NO   | MUL | 0       |                |
| counter  | int(11)             | NO   |     | 1       |                |
| fo       | datetime            | YES  |     | NULL    |                |
| lo       | datetime            | YES  |     | NULL    |                |
+----------+---------------------+------+-----+---------+----------------
What is the problem?
Thanks in advance for the help.