Koozali.org: home of the SME Server

How do you monitor your logs?

Offline milaweb

  • **
  • 25
  • +0/-0
    • http://www.milasupport.dk
How do you monitor your logs?
« on: February 05, 2008, 07:33:30 AM »
I have created a simple cron-daily-job that looks for errors,SSH attacks and raid-degraded-errors in messages.

What do you scan for in you logs?

Code: [Select]
#/bin/sh
DATE=`date -d yesterday +"%b %e"`
echo "Getting count"
countError=`grep "$DATE" /var/log/messages | grep -i 'error' | wc -l`
countSshd=`grep "$DATE" /var/log/messages | grep -i 'sshd:' | wc -l`
countRaid=`grep "$DATE" /var/log/messages | grep -i 'degraded' | wc -l`

echo "Errors: $countError for $DATE"
echo "Ssh refused: $countSshd for $DATE"

if [ $countError -ge 1 -o $countSshd -ge 1 ]; then
mail -s "There are $countError errors in Messages" mail@adress.dk <<EOF

Der er følgende fejl i Messages-loggen:
`grep "$DATE" /var/log/messages | grep -i 'error'`

Foelgende er afvist af sshd ($countSshd):
`grep "$DATE" /var/log/messages | grep -i 'sshd: '`

EOF
fi

if [ $countRaid -ge 1 ]; then
mail -s "RAID-ERRORs ON THE SERVER" mail@adress.dk <<EOF

Der er følgende RAID-errors i Messages-loggen:
`grep "$DATE" /var/log/messages | grep -i 'degraded'`
EOF
fi


Offline brianr

  • *
  • 990
  • +2/-0
Re: How do you monitor your logs?
« Reply #1 on: February 05, 2008, 10:24:31 AM »
SME8 has logwatch which scans the logs every night and summarises anything it "thinks" is worth noting, see here:

http://www2.logwatch.org:81/

I think there was a logwatch contrib at one time - anyone know if it is still extant?
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline Teviot

  • *
  • 610
  • +0/-0
Re: How do you monitor your logs?
« Reply #2 on: February 06, 2008, 12:39:29 AM »
I guess this won't be available for SME Server v7.3

Teviot
Regards
M0GLJ
......................................................
I am new to SAIL SME Server v8b6 and have been using SME for many years.
I have already done some research and only ask questions if I still can't work it out.

Offline slords

  • *****
  • 235
  • +3/-0
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." -- Rich Cook

Offline Teviot

  • *
  • 610
  • +0/-0
Re: How do you monitor your logs?
« Reply #4 on: February 06, 2008, 01:35:14 AM »
Is there any SME specific documentation available for version 7.3?

Thanks for you help too.

Regards
Teviot
Regards
M0GLJ
......................................................
I am new to SAIL SME Server v8b6 and have been using SME for many years.
I have already done some research and only ask questions if I still can't work it out.

Offline brianr

  • *
  • 990
  • +2/-0
Re: How do you monitor your logs?
« Reply #5 on: February 06, 2008, 10:33:37 AM »
just tried

yum install logwatch

on 7.3, seems to be installed and working fine, runs daily, try

/etc/cron.daily/0logwatch

for a test, results sent to admin email.

Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline milaweb

  • **
  • 25
  • +0/-0
    • http://www.milasupport.dk
Re: How do you monitor your logs?
« Reply #6 on: February 06, 2008, 11:21:00 AM »
Thanks...

I'll just install logwatch and give it a try.

Offline okepc

  • ****
  • 118
  • +0/-0
    • http://www.okepc.nl
Re: How do you monitor your logs?
« Reply #7 on: February 06, 2008, 03:11:00 PM »
Im using logcheck and logwatch.
Logcheck is an old utility but still working like a charm.
It wil send you a mail report every hour to the admin account.

ftp://ftp.funet.fi/pub/mirrors/archive.redhat.com/contrib/libc6/i386/logcheck-1.1.1-1.i386.rpm
ftp://ftp.icm.edu.pl/vol/rzm1/linux-redhat-contrib/libc6/i386/logcheck-1.1.1-1.i386.rpm

Regards

Dirk
« Last Edit: February 06, 2008, 03:14:45 PM by okepc »

Offline milaweb

  • **
  • 25
  • +0/-0
    • http://www.milasupport.dk
Re: How do you monitor your logs?
« Reply #8 on: February 06, 2008, 08:05:07 PM »

Code: [Select]
yum install logwatch
on 7.3, seems to be installed and working fine, runs daily, try
/etc/cron.daily/0logwatch
for a test, results sent to admin email.

It installs fine,but it doesn't send any mail if i run the /etc/cron.daily/0logwatch.
Did you setup anything after install?
My testserver is a VMware and i have had some problems with mails in that setup earlier. Maybe thats why....

Offline brianr

  • *
  • 990
  • +2/-0
Re: How do you monitor your logs?
« Reply #9 on: February 07, 2008, 07:19:08 AM »
It works out of the box for me.
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline haymann

  • *
  • 212
  • +0/-0
Re: How do you monitor your logs?
« Reply #10 on: February 11, 2008, 07:51:09 PM »
Very nice! Worked for me as well w/ no other configuration needed.

Offline geoff

  • ***
  • 61
  • +0/-0
Re: How do you monitor your logs?
« Reply #11 on: April 03, 2008, 02:54:03 PM »
All good and it works well, but floods me with emails.

Sorry to be a klutz, but how do I uninstal it, please?

Offline geoff

  • ***
  • 61
  • +0/-0
Re: How do you monitor your logs?
« Reply #12 on: April 03, 2008, 03:04:44 PM »
Google is my Friend.

yum remove .......

Offline raem

  • *
  • 3,972
  • +4/-0
Re: How do you monitor your logs?
« Reply #13 on: April 04, 2008, 07:59:34 AM »
geoff

Quote
yum remove .......

That's OK if there are no other dependencies.

Until
yum remove packagename
is fixed, a safer removal method that only removes the specifc package is
rpm -e logwatch
and this is the currently recommended method to use.
« Last Edit: April 04, 2008, 08:02:40 AM by RayMitchell »
...

Offline geoff

  • ***
  • 61
  • +0/-0
Re: How do you monitor your logs?
« Reply #14 on: April 04, 2008, 08:22:03 AM »
Thank you, Ray, much appreciated. I'll do that in future.

In the meantime 'yum remove logwatch' did the trick.

Thanks for your help.

Offline raem

  • *
  • 3,972
  • +4/-0
Re: How do you monitor your logs?
« Reply #15 on: April 04, 2008, 08:58:11 AM »
geoff

People have inadvertantly removed a lot more than just one package using the yum remove package command, and left their server in a non functional state, that was quite difficult to fix.
...

Offline geoff

  • ***
  • 61
  • +0/-0
Re: How do you monitor your logs?
« Reply #16 on: April 04, 2008, 10:50:32 AM »
Thanks, Ray.

I appreciate your concern and now understand the peril involved with 'Yum remove packagename'. Dumb luck this time as everything is OK but 'yum remove' is out of the vocabulary now, replaced by 'rpm -e'.

Thanks for your input, concern, and ongoing assistance, Ray.  :-)