配置rsyslog远程日志服务器
环境:
系 统:Centos7.4
服务端:172.20.10.6
客户端:172.20.10.7 (lncs.net)
服务端配置
1、修改rsyslog配置文件
[root@localhost ~]# vim /etc/rsyslog.conf # Provides TCP syslog reception $ModLoad imtcp $InputTCPServerRun 514
找到以上两个模块,去掉前面注释, :wq 保存退出
2、重启rsyslog服务
[root@localhost ~]# systemctl restart rsyslog.service
3、查看服务启动是否成功
[root@localhost ~]# netstat -antup |grep 514 tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 1116/rsyslogd tcp6 0 0 :::514 :::* LISTEN 1116/rsyslogd
客户端配置
1、修改rsyslog配置文件
[root@qunniao ~]# vim /etc/rsyslog.conf *.* @@172.20.10.245:514
在配置文件末尾插入一行,添加以上内容(172.20.10.245为远程rsyslog服务ip),:wq 保存退出
2、重启rsyslog服务
[root@qunniao ~]# systemctl restart rsyslog.service
测试
1、客户端重启sshd服务
[root@qunniao ~]# systemctl restart sshd
2、服务端开启日志查询
[root@localhost ~]# tailf /var/log/messages Jan 11 13:35:07 qunniao systemd: Stopping OpenSSH server daemon... Jan 11 13:35:07 qunniao systemd: Started OpenSSH Server Key Generation. Jan 11 13:35:07 qunniao systemd: Starting OpenSSH server daemon... Jan 11 13:35:07 qunniao systemd: Started OpenSSH server daemon.
以上信息可以看到服务端已经能收到客户端发送的日志
温馨提示:如无特殊说明,本站文章均为作者原创,转载时请注明出处及相应链接!