老夏家的云
永远年轻,永远热泪盈眶!

Linux配置日志服务器

Linux配置日志服务器


日志服务器配置文件:/etc/rsyslog.conf

服务器端:

服务器IP如下:
enter description here

编辑日志服务器的配置文件:
enter description here

这里UDP或者TCP任选一个
enter description here

将注释的两句复制一遍,然后取消注释即可
enter description here

进入目录下创建配置文件,配置需要监控的客户端
enter description here

Vim编辑器打开
enter description here
内容如下:
enter description here

内容格式如下:
:属性, 比较操作符, "值" 保存位置

属性包括以下内容
fromhost 哪个主机名发过来的
fromhost-ip 哪个ip发过来的
msg 从日志信息里的内容判断
hostname 从日志中的主机名判断
比较操作符包括以下内容
contains 包含
isequal 等于
startswith 以...开头

重启日志服务
enter description here

可以看到目标目录下已经生成一个目录记录文件,且内容为空
enter description here

客户机端:

客户机端IP为:192.168.0.100/24

编辑配置文件:
enter description here
在末尾加上如下行指定日志服务器地址和端口号
enter description here
保存退出,重启日志服务
enter description here

开始验证:
用服务器端通过ssh试图连接客户端:
enter description here

由于输入密码,连接失败

现在在去查看日志记录文件:
enter description here

如上,ssh连接的记录已经被记录在日志文件中

posted @ 2018-11-11 21:44  老夏家的云  阅读(5633)  评论(0编辑  收藏  举报