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?