我想将文件从交换机记录到 mysql 数据库。我正在使用 syslog-ng 并且在配置文件中,我做了以下修改
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); }
当我运行命令service syslog restart
时,我收到以下错误
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
我怎样才能克服这个问题以使日志能够被定向到数据库?