一、日志文件
1.文件的作用
将系统和应用发生的事件记录至日志中,以助于排错和分析使用。
记录的内容包括:时间,地点,人物,事件
2.常用日志
![](https://img-blog.csdnimg.cn/img_convert/2e4111dc60b44d19f7dc857042951ea9.png)
3.日志文件
![](https://img-blog.csdnimg.cn/img_convert/0b07d20913645971723bd2b7e76564fd.png)
二、Rsylog日志处理系统
Rsyslog配置文件解析
配置文件路径:/etc/rsyslog.conf
分为三大块:
MODULES:相关模块配置
GLOBAL DIRECTIVES:全局配置
RULES:日志记录相关的规则配置
三、实验
vim /etc/rsyslog.conf
![](https://img-blog.csdnimg.cn/img_convert/a1c55f0c026207428e243d8478ff32eb.png)
vim /etc/ssh/sshd_config
![](https://img-blog.csdnimg.cn/img_convert/e2b7ad21ee0569e2b94521c96375284f.png)
![](https://img-blog.csdnimg.cn/img_convert/f9572b40f0780df084aad6497a44ceec.png)
第二台xshell
![](https://img-blog.csdnimg.cn/img_convert/c2d024f24beab07fc253b8ba02b62d43.png)
再回到第一台xshell
![](https://img-blog.csdnimg.cn/img_convert/86098a55b9292c7ab42ef77b2d03c92e.png)
vim /etc/rsyslog.conf
![](https://img-blog.csdnimg.cn/img_convert/8b4349a4a96360be30e941b1a41d53ed.png)
两台xshell防火墙都关闭
![](https://img-blog.csdnimg.cn/img_convert/bf062abc191ec15d4e85afd27f09bb44.png)
vim /etc/rsyslog.conf 取消注释
![](https://img-blog.csdnimg.cn/img_convert/af25d38be72768eabc221b5bc6c32e58.png)
![](https://img-blog.csdnimg.cn/img_convert/32ee2f1d7312100279f039a21104486a.png)
回到第一台输入日志 1
![](https://img-blog.csdnimg.cn/img_convert/93f3d538b909ce70e54a8aba40217269.png)
![](https://img-blog.csdnimg.cn/img_convert/be7250aa8c6191e1223d1432bf049b77.png)