美文网首页
怎么把自己的主机设置为日志服务器

怎么把自己的主机设置为日志服务器

作者: 六月天的安静 | 来源:发表于2017-08-09 19:22 被阅读33次

在这里把centos6 作为日志服务器:地址是:192.168.247.130centos7作为客户端

如果想让本机成为日志服务器,可以打开rsyslog配置文件/etc/rsyslog.conf中指定的模块,让其监听在514端口,这些模块为:

[root@centos6:~]# vim  /etc/rsyslog.conf
$ModLoad imudp
$UDPServerRun 514

$ModLoad imtcp
$InputTCPServerRun 514

编辑完配置文件要重启rsyslog服务才能生效:

service rsyslog restart

查看一下端口是否开启:
[root@centos6:~]# ss -tunlp | grep 514

在客户端(centos7)上修改配置文件:

[root@centos7:~]#vim /etc/rsyslog.conf 
Paste_Image.png

重启服务:

    [root@centos7:~]#systemctl  restart rsyslog

测试:

在客户端centos7上发条日志观察服务器是否可以接受到:

[root@centos7:~]#logger "66666666666666" 

在服务端centos6上看有没有记录到刚刚客户端发的那条日志:


相关文章

网友评论

      本文标题:怎么把自己的主机设置为日志服务器

      本文链接:https://www.haomeiwen.com/subject/uibqrxtx.html