本文介绍了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
& ~

错误:

最终,我想同时登录到文件和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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:18