Linux下配置日志服务器

Linux配置日志服务器


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

服务器端:

服务器IP如下:
enter description here

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

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

选择TCP,将注释的两句复制一遍,然后取消注释即可
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连接的记录已经被记录在日志文件中

  • 4
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值