文章目录
日志管理的意义
日志对于安全来说,非常重要,他记录了系统每天发生的各种各样的事情,你可以通过他来检查错误发生的原因,或者受到攻击时攻击者留下的痕迹。
日志主要的功能有:审计和监测。他还可以实时的监测系统状态,监测和追踪侵入者等等
一般情况下我们的日志主要放在哪里?
[root@localhost ~]# ls /var/log/
anaconda.ifcfg.log ConsoleKit mysqld.log sssd
anaconda.log cron ntpstats tallylog
anaconda.program.log cups pm-powersave.log tomcat6
anaconda.storage.log dmesg ppp wpa_supplicant.log
anaconda.syslog dracut.log prelink wtmp
anaconda.xlog gdm sa Xorg.0.log
anaconda.yum.log httpd samba Xorg.9.log
audit lastlog secure yum.log
boot.log maillog spice-vdagent.log
btmp messages spooler
[root@localhost ~]#
常用的日志文件:
btmp 记录登录失败的信息
lastlog 记录最近几次登录事件和最后一次不成功的登录
messages 从syslog 记录信息(有的链接到syslog文件)
utmp 记录当前登录的每一个用户
whmp 系统登录情况: 登入登出
登录信息查看
last 查看登录日志内容
[root@localhost ~]# last
root pts/1 192.168.148.1 Sat Sep 28 02:08 still logged in
root pts/0 :0.0 Sat Sep 28 02:07 still logged in
root pts/0 :0.0 Sat Sep 28 02:04 - 02:06 (00:02)
清空日志文件
[root@localhost ~]# > /var/log/wtmp