<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.5">
</HEAD>
<BODY>
After I posted to the list, first I did when I run into this problem, I enabled the debug and noticed the following error:<BR>
Apr 23 15:58:15 alfnetengi01 syslog-ng[7826]: Error establishing SQL connection; type='mysql', host='localhost', port='', username='syslogadmin', database='syslog', error='2002: Can\'t connect to local MySQL server through socket \'/var/run/mysqld/mysqld.sock\' (2)'<BR>
It appears to me it try to connect to MySQL using sock instead of TCP, as I original assumed. Is there a way to use TCP connection? I will play around as well. <BR>
Thanks.<BR>
<BR>
-----Original Message-----<BR>
<B>From</B>: Arnold Wang <<A HREF="mailto:Arnold%20Wang%20%3carnold.wang@inovis.com%3e">arnold.wang@inovis.com</A>><BR>
<B>To</B>: <A HREF="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</A><BR>
<B>Subject</B>: syslog-ng 3.0.1, open source edition, fails write to MySQL DB<BR>
<B>Date</B>: Thu, 23 Apr 2009 12:35:07 -0700<BR>
<BR>
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:<BR>
# Write the logs to MySQL DB<BR>
destination dd_mysql {<BR>
sql(type(mysql)<BR>
host("localhost") username("syslogadmin") password("syslogadmin")<BR>
database("syslog")<BR>
table("logs")<BR>
columns("host", "facility", "priority", "level", "tag", "datetime", "program", "msg", "seq")<BR>
values("$HOST", "$FACILITY", "$PRIORITY", "$LEVEL", "$TAG", "$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC", "$PROGRAM", "$MSG", "$SEQ")<BR>
indexes("seq"));<BR>
# program("/usr/bin/mysql -usyslogadmin -psyslogadmin syslog"<BR>
# template("INSERT INTO logs (host, facility, priority, level, tag, datetime, program, msg, seq)<BR>
# VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$PROGRAM', '$MSG', '$SEQ' );\n")<BR>
# template-escape(yes));<BR>
};<BR>
It works if I use the program driver, as currently commented out. <BR>
The table is configured as following, using the schema defined by php-syslog-ng 2.9.8m.<BR>
+----------+---------------------+------+-----+---------+----------------+<BR>
| Field | Type | Null | Key | Default | Extra |<BR>
+----------+---------------------+------+-----+---------+----------------+<BR>
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment | <BR>
| host | varchar(128) | YES | MUL | NULL | | <BR>
| facility | varchar(10) | YES | MUL | NULL | | <BR>
| priority | varchar(10) | YES | MUL | NULL | | <BR>
| level | varchar(10) | YES | | NULL | | <BR>
| tag | varchar(10) | YES | | NULL | | <BR>
| datetime | datetime | YES | MUL | NULL | | <BR>
| program | varchar(15) | YES | MUL | NULL | | <BR>
| msg | text | YES | | NULL | | <BR>
| seq | bigint(20) unsigned | NO | MUL | 0 | | <BR>
| counter | int(11) | NO | | 1 | | <BR>
| fo | datetime | YES | | NULL | | <BR>
| lo | datetime | YES | | NULL | | <BR>
+----------+---------------------+------+-----+---------+----------------<BR>
What is the problem? <BR>
Thanks in advance for the help.<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
</BODY>
</HTML>