18.5 分析登录文件
18.5.1 CentOS 默认提供的 logwatch
[root@study ~]# yum install /mnt/Packages/perl-5.*.rpm
> /mnt/Packages/perl-Date-Manip-*.rpm \
> /mnt/Packages/perl-Sys-CPU-*.rpm \
> /mnt/Packages/perl-Sys-MemInfo-*.rpm \
> /mnt/Packages/logwatch-*.rpm
# 得要安装数个软件才能够顺利的安装好 logwatch 喔!当然,如果你有网络,直接安装就好了!
[root@study ~]# ll /etc/cron.daily/0logwatch
-rwxr-xr-x. 1 root root 434 Jun 10 2014 /etc/cron.daily/0logwatch
[root@study ~]# /etc/cron.daily/0logwatch[root@study ~]# mail
Heirloom Mail version 12.5 7/5/10\. Type ? for help.
"/var/spool/mail/root": 5 messages 2 new 4 unread
>N 4 root Thu Jul 30 19:35 29/763 "testing at job"
N 5 logwatch@study.cento Thu Aug 20 17:55 97/3045 "Logwatch for study.centos.vbird (Linux)"
& 5
Message 5:
From root@study.centos.vbird Thu Aug 20 17:55:23 2015
Return-Path: <root@study.centos.vbird>
X-Original-To: root
Delivered-To: root@study.centos.vbird
To: root@study.centos.vbird
From: logwatch@study.centos.vbird
Subject: Logwatch for study.centos.vbird (Linux)
Auto-Submitted: auto-generated
Precedence: bulk
Content-Type: text/plain; charset="iso-8859-1"
Date: Thu, 20 Aug 2015 17:55:23 +0800 (CST)
Status: R
# logwatch 会先说明分析的时间与 logwatch 版本等等信息
########## Logwatch 7.4.0 (03/01/11) ##########
Processing Initiated: Thu Aug 20 17:55:23 2015
Date Range Processed: yesterday
( 2015-Aug-19 )
Period is day.
Detail Level of Output: 0
Type of Output/Format: mail / text
Logfiles for Host: study.centos.vbird
#################################
# 开始一项一项的数据进行分析!分析得很有道理啊!
--------------------- pam_unix Begin ------------------------
su-l:
Sessions Opened:
dmtsai -> root: 2 Time(s)
---------------------- pam_unix End -------------------------
--------------------- Postfix Begin ------------------------
894 Bytes accepted 894
894 Bytes delivered 894
======== ==================================================
2 Accepted 100.00%
-------- --------------------------------------------------
2 Total 100.00%
======== ==================================================
2 Removed from queue
2 Delivered
---------------------- Postfix End -------------------------
--------------------- SSHD Begin ------------------------
Users logging in through sshd:
dmtsai:
192.168.1.200: 2 times
Received disconnect:
11: disconnected by user : 1 Time(s)
---------------------- SSHD End -------------------------
--------------------- Sudo (secure-log) Begin ------------------------
dmtsai => root
--------------
/bin/su - 2 Time(s).
---------------------- Sudo (secure-log) End -------------------------
# 当然也得说明一下目前系统的磁盘使用状态喔!
--------------------- Disk Space Begin ------------------------
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 10G 3.7G 6.3G 37% /
devtmpfs 1.4G 0 1.4G 0% /dev
/dev/vda2 1014M 141M 874M 14% /boot
/dev/vda4 1014M 33M 982M 4% /srv/myproject
/dev/mapper/centos-home 5.0G 642M 4.4G 13% /home
/dev/mapper/raidvg-raidlv 1.5G 33M 1.5G 3% /srv/raidlvm
---------------------- Disk Space End -------------------------18.5.2 鸟哥自己写的登录文件分析工具:
Last updated