Rsyslog v5日志远程到mysql [英] Rsyslog v5 log remote to mysql

查看:248
本文介绍了Rsyslog v5日志远程到mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将远程事件记录到位于中央rsyslog服务器(v5.10.1-0.7.49-这是SLES11sp3中的默认版本)的mysql数据库中.我已经尝试登录到文件,并且可以正常工作:

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
& ~

但是当我尝试将其更改为mysql db时,它会失败并出现语法错误:

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
& ~

错误:

2月20日11:16:27 idm-syslog rsyslogd:最后一次错误发生在/etc/rsyslog.conf,第61行::fromhost-ip,isequal," 147.110.250.217:ommysql:localhost,Syslog, rsyslog,身份" 2月20日11:16:27 idm-syslog rsyslogd-2124:配置错误:无法解释主配置文件'/etc/rsyslog.conf'. [尝试 http://www.rsyslog.com/e/2124 ]

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 ]

最终,我想同时登录到文件和mysql,可以在一个命令中执行此操作还是必须使用多个命令?

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 ?

谢谢

推荐答案

您需要添加

$ModLoad ommysql

之前

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

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

这是我在服务器中运行的CONF

This is my CONF running in my Server

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

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

$ ModLoad ommysql

$ModLoad ommysql

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

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

希望它可以帮助其他用户.

Hope it help another users.

这篇关于Rsyslog v5日志远程到mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆