1、日志的功能
1)用于记录系统、程序运行中发生的各种事件
2)通过阅读日志,有助于诊断和解决系统故障
2、日志文件的分类
1、内核及系统日志
2、用户日志
3、程序日志
3、日志的默认存储位置:/var/log
4、管理日志的服务:
rsyslogd
[root@localhost ~]# vim /etc/rsyslog.conf
5、日志服务器构建步骤:
log 服务器-------- 192.168.1.1
其他服务器------ 192.168.1.2
1、配置日志服务器
[root@localhost ~]# vim /etc/sysconfig/rsyslog
修改:
SYSLOGD_OPTIONS="‐r ‐x ‐m 0"
[root@localhost ~]# service syslog restart
2、配置其他服务器
[root@localhost ~]# vim /etc/syslog.conf
修改:
cron.* @192.168.1.1
[root@localhost ~]# service syslog restart
6、查看用户类日志:
查看用户类日志需要使用专用的工具(命令)才能查看
- [root@localhost ~]# users
- [root@localhost ~]# who
- [root@localhost ~]# w
- [root@localhost ~]# last
- [root@localhost~]# lastb
7、日志管理策略:
1)及时作好备份和归档
2)延长日志保存期限
3)控制日志访问权限
4)集中管理日志