Linux日志的来龙去脉(下)
# chkconfig psacct on
# /etc/init.d/psacct start
|
# lastcomm root
[root@localhost log]# lastcomm root | more
lastcomm root pts/1 0.03 secs Wed Dec 2 14:16
crond SF root __ 0.02 secs Wed Dec 2 14:15
mrtg S root __ 0.65 secs Wed Dec 2 14:15
crond SF root __ 0.01 secs Wed Dec 2 14:10
mrtg S root __ 0.65 secs Wed Dec 2 14:10
crond SF root __ 0.02 secs Wed Dec 2 14:10
sadc S root __ 0.02 secs Wed Dec 2 14:10
crond SF root __ 0.02 secs Wed Dec 2 14:05
mrtg S root __ 0.63 secs Wed Dec 2 14:05
bash F root pts/1 0.00 secs Wed Dec 2 14:02
bash F root pts/1 0.00 secs Wed Dec 2 14:01
|
# lastcomm rm
rm root pts/1 0.00 secs Wed Dec 2 14:21
rm root pts/1 0.00 secs Wed Dec 2 14:19
rm root pts/1 0.00 secs Wed Dec 2 14:19
|
# sa
207 0.41re 0.40cp 7408k mrtg
6 0.04re 0.04cp 7240k awstats.pl
15 0.01re 0.00cp 2108k ***other*
1242 53.91re 0.00cp 6081k sshd
|
6 0.04re 0.04cp 7240k awstats.p
|
# sa -u
root 0.00 cpu 595k mem accton
root 0.00 cpu 1339k mem logrotate.gf2tt
|
#Log all the mail messages in one place
mail.* /var/log/maillog
|
# Save mail and news errors of level err and higher in aspecial file.
uucp,news.crit /var/log/spooler
|
#Everybody gets emergency messages
,
plus log them on anther machine
*.emerg *
*.emerg @linuxaid.com.cn
|
#Root and Tiger get alert and higher messages
*.alert root,tiger
|
#Log all kernel messages to the console
#Logging much else clutters up the screen
#kern.* /dev/console
|
用户可以在一行中指明所有的设备。下面的例子把
info
或更高级别的消息送到
/var/log/messages
,除了
mail
以外。级别
"none"
禁止一个设备:
|
#Log anything
(
except mail
)
of level info or higher
#Don log private authentication messages!
*.info:mail.none;authpriv.none /var/log/messages
|