##日志记录系统每天发生的各种各样的事情,比如监控系统的状况,排查系统的故障等。你可以通过日志来检查错误发生的原因,或者受到攻击时留下的痕迹。日志的主要功能是审计和监测,还有实时的监测系统状态,监测和追踪入侵者
## 经常查看的系统文件是 /var/log/message,它是系统核心日志文件
Linux系统日志
./var/log/messages
./etc/logrotate.conf 日志分割文件
./var/log/dmesg
./last 命令,调用的是/var/log/wtmp
./lastb命令查看登录失败的用户,对应的文件是/var/log/btmp
./var/logsecure
/var/log/messages 这个是经常查看的日志文件 核心系统日志文件,包含启动时间的引导消息,以及系统运行的其他状态消息,I/O错误 网络错误和其他系统错误都会记录到这个文件下
[root@yzllinux123 ~]# less /var/log/messages #查看系统日志文件的信息
Jan 29 07:01:01 yzllinux123 systemd: Started Session 3 of user root.
Jan 29 07:01:01 yzllinux123 systemd: Starting Session 3 of user root.
Jan 29 07:12:33 yzllinux123 systemd-logind: Removed session 1.
Jan 29 07:12:33 yzllinux123 systemd: Removed slice User Slice of root.
Jan 29 07:12:33 yzllinux123 systemd: Stopping User Slice of root.
Jan 29 07:12:40 yzllinux123 systemd: Created slice User Slice of root.
Jan 29 07:12:40 yzllinux123 systemd: Starting User Slice of root.
Jan 29 07:12:40 yzllinux123 systemd: Started Session 4 of user root.
Jan 29 07:12:40 yzllinux123 systemd-logind: New session 4 of user root.