搞了我半小个时查找资料。。最后,在一个官方文档中找到他。。。
http://www.rsyslog.com/doc/ommysql.html
Sample:
The following sample writes all syslog messages to the database "syslog_db" on mysqlsever.example.com. The server is being accessed under the account of "user" with password "pwd".
$ModLoad ommysql
*.* action(type="ommysql" server="mysqlserver.example.com" serverport="1234"
db="syslog_db" uid="user" pwd="pwd")
Legacy Sample:
The same as above, but in legacy config format (pre rsyslog-v6):
$ModLoad ommysql
$ActionOmmysqlServerPort 1234 # use non-standard port
*.* :ommysql:mysqlserver.example.com,syslog_db,user,pwd
我用第二种方法实现了。
第一种不报错,但日志显示不出来,暂不搞。
时间: 2024-09-23 04:42:36