Syslog-ng connecting to mysql
Asked Answered
A

2

5

I would like to log files from a switch to a mysql database. I am using syslog-ng and in the configuration file, i have done the following amendments

filter f_no_debug { not level(debug); };

destination d_mysql {
sql(
type(mysql)
username("logs")
password("SECUREPASSWORD")
database("logs")
host("localhost")
table("logs")
columns("host", "facility", "priority", "level", "tag", "datetime", "program", "msg")
values("$HOST", "$FACILITY", "$PRIORITY", "$LEVEL", "$TAG","$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC","$PROGRAM", "$MSG")
indexes("datetime", "host", "program", "pid", "message")
);
};

log {source(s_net); source(s_src); filter(f_no_debug); destination(d_mysql); }

When i run the command service syslog restart, i get the following error

Unable to initialize database access (DBI);rc='-1', error='No such file or directory (2)' Error initializing dest driver;dest='d_mysql',id='d_mysql'#0 Error initializing message pipeline

How can i overcome this problem to enable logs to be directed to the database?

Alexisaley answered 10/9, 2013 at 12:2 Comment(0)
H
8

On Ubuntu and Debian:

MySQL database server driver for libdbi:

apt-get install libdbd-mysql

PostgreSQL database server driver for libdbi:

apt-get install libdbd-pgsql

SQLite3 database driver for libdbi:

apt-get install libdbd-sqlite3
Heteroclite answered 2/11, 2016 at 9:54 Comment(0)
C
3

This message seems to be caused when the libdbi drivers are not installed. Take a look at http://libdbi.sourceforge.net/ or see if there is a libdbi package for your distribution.

Caterinacatering answered 10/9, 2013 at 14:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.