赞
踩
存放位置
/var/log
,该目录下目录如下:
./messages
没有明确指明的日志
./secure
安全日志
./dmesg
系统开机相关日志
./audit/audit.log
审计日志
./yum.log
yum日志
如:./mysqld.log
, ./httpd/access_log
, ./httpd/error_log
二进制文件,只能用命令查看
[root@harbor ~]# w
22:25:17 up 39 days, 4:41, 1 user, load average: 0.00, 0.10, 0.11
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 10.10.222.191 22:20 5.00s 0.01s 0.00s w
[root@harbor ~]# last
root pts/0 10.10.222.191 Thu Jul 1 22:20 still logged in
root pts/1 10.10.222.191 Thu Jul 1 20:14 - 21:50 (01:35)
root pts/1 10.10.213.46 Wed Jun 16 16:14 - 16:16 (00:02)
root pts/1 10.10.222.191 Mon May 31 14:33 - 14:58 (00:24)
root pts/1 10.10.222.191 Sun May 30 21:16 - 21:31 (00:15)
[root@harbor ~]# lastlog
用户名 端口 来自 最后登陆时间
root pts/0 10.10.222.191 四 7月 1 22:20:56 +0800 2021
bin **从未登录过**
daemon **从未登录过**
adm **从未登录过**
lp **从未登录过**
sync **从未登录过**
配置文件:
/etc/rsyslog.conf
infn;mail.none;authpriv.none;cron.none /var/log/messages
*.err;kern.debug;daemon.notice /var/adm/messages
# Thr authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg :omusrmsg:*
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
/etc/rsyslog.cof
#去掉注释,打开tcp协议接收日志功能
$ModLoad imtcp
$InputTCPServerRun 514
#打开UDP协议接收日志功能
$ModLoad imudp
$UDPServerRun 514
#一个@表示UDP,@@表示tcp
local7.* @@10.10.239.xxx:514
重启rsyslog,关闭防火墙
测试:客户机产生一条日志的方法
# logger -p local6.info -t "标题" “内容”
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。