mysql 远程日志_Rsyslog v5日志远程到mysql

bd96500e110b49cbb3cd949968f18be7.png

I am trying to log remote events to a mysql db sitting on a central rsyslog server (v5.10.1-0.7.49 - This is the default version in SLES11sp3). I have tried logging to a file and that works:

:fromhost-ip, isequal, "147.110.250.217" /var/log/remotefile

& ~

But when I try to change it to a mysql db it fails with a syntax error:

:fromhost-ip, isequal, "x.x.x.x":ommysql:localhost,Syslog,user,pwd

& ~

Error:

Feb 20 11:16:27 idm-syslog rsyslogd: the last error occured in /etc/rsyslog.conf, line 61:":fromhost-ip, isequal, "147.110.250.217" :ommysql:localhost,Syslog,rsyslog,identity"

Feb 20 11:16:27 idm-syslog rsyslogd-2124: CONFIG ERROR: could not interpret master config file '/etc/rsyslog.conf'. [try http://www.rsyslog.com/e/2124 ]

Ultimately, I would like to log both to file and mysql, can I do this in a single command or must I use multiple ones ?

Thanks

解决方案

You need to add

$ModLoad ommysql

before

:fromhost-ip, isequal, "x.x.x.x":ommysql:localhost,Syslog,user,pwd

& ~

This is my CONF running in my Server

:fromhost-ip, isequal, "X.X.X.X" /var/log/mikrotik.log

$ModLoad ommysql

:fromhost-ip, isequal, "X.X.X.X":ommysql:SERVER_IP,DATABASE,USER,PASSWORD

Hope it help another users.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值