wlanboy
Content Contributer
It is one of the tasks I want to do but never try to finish: Check logfiles.
Look through all the logfiles to see if something happend that should not happen.
It is a job which is boring and so a single important line can splip through your scrolling.
But linux-like: There is a tool for it - called logwatch.
logwatch --service sshd --range today --detail 10
output is something like:
################### Logwatch 7.4.0 (03/01/11) ####################
Processing Initiated: Wed Aug 21 07:19:18 2013
Date Range Processed: today
( 2013-Aug-21 )
Period is day.
Detail Level of Output: 10
Type of Output/Format: stdout / text
Logfiles for Host: servnl
##################################################################
--------------------- SSHD Begin ------------------------
SSHD Killed: 2 Time(s)
Users logging in through sshd:
aname:
8.8.8.8 (a-host-name): 5 times
bname:
9.9.9.9 (another-host-name): 2 times
---------------------- SSHD End -------------------------
###################### Logwatch End #########################
Or postfix:
logwatch --service postfix --range today --detail 10
A great tool to get weekly reports about all services which are running on a vps.
Look through all the logfiles to see if something happend that should not happen.
It is a job which is boring and so a single important line can splip through your scrolling.
But linux-like: There is a tool for it - called logwatch.
- Installation
sudo apt-get install logwatch libdate-manip-perl (yum: perl-DateManip)
sudo mkdir /var/cache/logwatch
sudo cp /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf/
Thats all. The cache dir and the default config are not part of the installer because logwatch can be easily used by command line. You do need them only if you want to run a cronjob.
perl-DateManip is a easy option to define date ranges.
- Configuration
Code:sudo nano /etc/logwatch/conf/logwatch.conf
Output = mail
Format = html
MailTo = [email protected]
MailFrom = [email protected]
Encode = base64
#Range = yesterday
Range = between -7 days and -1 days
Detail = High
Service = All
Service can be all daemons like sshd.
Cron
00 20 * * * /usr/sbin/logwatch --mailto [email protected]
logwatch --service sshd --range today --detail 10
output is something like:
################### Logwatch 7.4.0 (03/01/11) ####################
Processing Initiated: Wed Aug 21 07:19:18 2013
Date Range Processed: today
( 2013-Aug-21 )
Period is day.
Detail Level of Output: 10
Type of Output/Format: stdout / text
Logfiles for Host: servnl
##################################################################
--------------------- SSHD Begin ------------------------
SSHD Killed: 2 Time(s)
Users logging in through sshd:
aname:
8.8.8.8 (a-host-name): 5 times
bname:
9.9.9.9 (another-host-name): 2 times
---------------------- SSHD End -------------------------
###################### Logwatch End #########################
Or postfix:
logwatch --service postfix --range today --detail 10
Code:
--------------------- Postfix Begin ------------------------
****** Summary *************************************************************************************
7.760K Bytes accepted 7,946
7.760K Bytes delivered 7,946
======== ==================================================
20 Accepted 100.00%
-------- --------------------------------------------------
20 Total 100.00%
======== ==================================================
20 Removed from queue
20 Delivered
****** Detail (1) **********************************************************************************
20 Delivered -------------------------------------------------------------------------------
20 wlanboy.com
=== Delivery Delays Percentiles ============================================================
0% 25% 50% 75% 90% 95% 98% 100%
--------------------------------------------------------------------------------------------
Before qmgr 0.00 0.00 4.00 9.50 10.10 11.00 11.00 11.00
In qmgr 0.00 0.00 0.01 0.03 0.04 0.04 0.04 0.04
Conn setup 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Transmission 0.01 0.01 0.01 0.02 0.02 0.03 0.03 0.03
Total 0.01 0.02 4.07 9.53 10.10 11.00 11.00 11.00
============================================================================================
---------------------- Postfix End -------------------------
Last edited by a moderator: