Linux下配置日志服务器
2018-11-11 本文已影响1人
老夏家的云
title: Linux配置日志服务器
tags: linux, 日志服务器
日志服务器配置文件:/etc/rsyslog.conf
服务器端:
服务器IP如下:

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

这里UDP或者TCP任选一个

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

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

Vim编辑器打开

内容如下:

内容格式如下:
:属性, 比较操作符, "值" 保存位置
属性包括以下内容
fromhost 哪个主机名发过来的
fromhost-ip 哪个ip发过来的
msg 从日志信息里的内容判断
hostname 从日志中的主机名判断
比较操作符包括以下内容
contains 包含
isequal 等于
startswith 以...开头
重启日志服务

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

客户机端:
客户机端IP为:192.168.0.100/24
编辑配置文件:

在末尾加上如下行指定日志服务器地址和端口号

保存退出,重启日志服务

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

由于输入密码,连接失败
现在在去查看日志记录文件:

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