centos中如何配置syslog-ng
在centos中安装syslog-ng服务器,需要按照以下步骤进行配置:
1、下载并安装syslog-ng
下载地址:http://www.balabit.com/network-security/syslog-ng/open-source-edition/
安装方法:
tar -zxvf syslog-ng-3.5.3.tar.gz
cd syslog-ng-3.5.3
./configure
make && make install
2、配置syslog-ng
修改配置文件/etc/syslog-ng/syslog-ng.conf,增加如下内容:
@version: 3.5
@include "scl.conf"
@include "`scl-root`/system/tty10.conf"
source s_local { system(); internal(); };
destination d_loghost { udp("127.0.0.1" port(514)); };
log { source(s_local); destination(d_loghost); };
3、启动syslog-ng服务
/etc/init.d/syslog-ng start
4、检查syslog-ng服务是否启动
ps -ef | grep syslog-ng
5、配置客户端
修改客户端配置文件/etc/syslog-ng/syslog-ng.conf,增加如下内容:
@version: 3.5
@include "scl.conf"
@include "`scl-root`/system/tty10.conf"
source s_local { system(); internal(); };
destination d_loghost { udp("192.168.1.100" port(514)); };
log { source(s_local); destination(d_loghost); };
重启syslog-ng客户端服务:
/etc/init.d/syslog-ng restart
6、查看日志
tail -f /var/log/messages
相关文章