<!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>
I figured out the problem. I have to use &quot;host=&quot;127.0.0.1&quot; to force it using TCP connection. I have tried &quot;(host=&quot;localhost&quot;, port=(&quot;3306&quot;)&quot; and it didn't work neither. I guess it is hard coded to use socket for localhost which seems reasonable. <BR>
There is a related question on this. If I want to use socket connection, how can I specify the socket file? It is by default using &quot;/var/run/mysqld/mysqld.sock&quot; which is different than the one in RHEL. <BR>
<BR>
-----Original Message-----<BR>
<B>From</B>: Arnold Wang &lt;<A HREF="mailto:Arnold%20Wang%20%3carnold.wang@inovis.com%3e">arnold.wang@inovis.com</A>&gt;<BR>
<B>To</B>: <A HREF="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</A><BR>
<B>Subject</B>: Re: syslog-ng 3.0.1, open source edition, fails write to MySQL DB<BR>
<B>Date</B>: Thu, 23 Apr 2009 13:06:55 -0700<BR>
<BR>
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 &lt;<A HREF="mailto:Arnold%20Wang%20%3carnold.wang@inovis.com%3e">arnold.wang@inovis.com</A>&gt;<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(&quot;localhost&quot;) username(&quot;syslogadmin&quot;) password(&quot;syslogadmin&quot;)<BR>
database(&quot;syslog&quot;)<BR>
table(&quot;logs&quot;)<BR>
columns(&quot;host&quot;, &quot;facility&quot;, &quot;priority&quot;, &quot;level&quot;, &quot;tag&quot;, &quot;datetime&quot;, &quot;program&quot;, &quot;msg&quot;, &quot;seq&quot;)<BR>
values(&quot;$HOST&quot;, &quot;$FACILITY&quot;, &quot;$PRIORITY&quot;, &quot;$LEVEL&quot;, &quot;$TAG&quot;, &quot;$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC&quot;, &quot;$PROGRAM&quot;, &quot;$MSG&quot;, &quot;$SEQ&quot;)<BR>
indexes(&quot;seq&quot;));<BR>
# program(&quot;/usr/bin/mysql -usyslogadmin -psyslogadmin syslog&quot;<BR>
# template(&quot;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&quot;)<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&nbsp;&nbsp;&nbsp; | Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Null | Key | Default | Extra&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<BR>
+----------+---------------------+------+-----+---------+----------------+<BR>
| id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | bigint(20) unsigned | NO&nbsp;&nbsp; | PRI | NULL&nbsp;&nbsp;&nbsp; | auto_increment | <BR>
| host&nbsp;&nbsp;&nbsp;&nbsp; | varchar(128)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | YES&nbsp; | MUL | NULL&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <BR>
| facility | varchar(10)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | YES&nbsp; | MUL | NULL&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <BR>
| priority | varchar(10)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | YES&nbsp; | MUL | NULL&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <BR>
| level&nbsp;&nbsp;&nbsp; | varchar(10)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | YES&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <BR>
| tag&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | varchar(10)&nbsp;&nbsp;&nbsp;&nbsp;&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&nbsp;&nbsp;&nbsp;&nbsp; | <BR>
| counter&nbsp; | int(11)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | NO&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; | 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <BR>
| fo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | datetime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | YES&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <BR>
| lo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | datetime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | YES&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <BR>
+----------+---------------------+------+-----+---------+----------------<BR>
What is the problem? <BR>
Thanks in advance for the help.<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
</BODY>
</HTML>