[syslog-ng] sql driver does'nt work on RHEL5 syslog-ng 3.0.7
Balazs Scheidler
bazsi at balabit.hu
Mon Sep 13 16:37:26 CEST 2010
On Wed, 2010-09-08 at 16:11 +0200, LEBRETON Philippe wrote:
> Hello
>
> i want to use mysl driver.
> My configuration file is :
>
> destination d_mysql_drv {
> sql(type(mysql)
> host("l1-154901l333sng") port("4058") username("root")
> password("admin") database("Syslog")
> table("logs")
> columns("host", "facility", "priority", "pid", "tag",
> "datetime", "program", "msg")
> values( '$HOST', '$FACILITY_NUM', '$LEVEL_NUM', '$PID', '$TAG',
> '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC',
> '$PROGRAM', '$MSG' ));
>
> };
>
> but in system log i have this error :
>
> Sep 8 15:54:01 154901l333sng syslog-ng[15030]: Error establishing SQL
> connection; type='mysql', host='l1-154901l333sng', port='4058',
> username='root', database='Syslog', error='2003: Can\'t connect to MySQL
> server on \'l1-154901l333sng\' (111)'
>
> on shell prompt, i use :
> mysql -u admin -p -h l1-154901l333sng -P 4058 Syslog
> an i can connect to database.
>
> Where is the problem?
> a bug ?
> a bad configuration?
Hmm... can you strace the client if it actually tries to connect? I
vaguely remember problems with libdbi drivers and port numbers, it may
connect to 3306 instead of 4058 as it is ignoring the port number.
.... I've checked this out, and it seems to have affected only the
"freetds" (=MSSQL) driver and not mysql.
So I'd definitely try to strace syslog-ng as it tries to connect to
MySQL to see what the actual problem is behind this error message. If
(111) is to be interpreted as an OS error number, it is
#define ECONNREFUSED 111 /* Connection refused */
Please check if syslog-ng tries to connect to the proper port number and
if MySQL is listening there and if a firewall doesn't block access.
--
Bazsi
More information about the syslog-ng
mailing list