From patchwork Mon Jan 11 15:18:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: heinzm@sourceware.org X-Patchwork-Id: 72147 Received: from mx01.util.phx2.redhat.com (mx1-phx2.redhat.com [209.132.183.26]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0BFOGxX006435 for ; Mon, 11 Jan 2010 15:24:17 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.util.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0BFIWO5028064; Mon, 11 Jan 2010 10:18:33 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0BFIVTP016933 for ; Mon, 11 Jan 2010 10:18:31 -0500 Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.8]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0BFIQ0X009376 for ; Mon, 11 Jan 2010 10:18:26 -0500 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by mx1.redhat.com (8.13.8/8.13.8) with SMTP id o0BFIEcj015423 for ; Mon, 11 Jan 2010 10:18:14 -0500 Received: (qmail 16737 invoked by uid 9450); 11 Jan 2010 15:18:14 -0000 Date: 11 Jan 2010 15:18:14 -0000 Message-ID: <20100111151814.16735.qmail@sourceware.org> From: heinzm@sourceware.org To: dm-cvs@sourceware.org, dm-devel@redhat.com X-RedHat-Spam-Score: -1.342 (AWL) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.8 X-loop: dm-devel@redhat.com Subject: [dm-devel] dmraid/logwatch dmeventd dmeventd.conf dmevent ... X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com --- dmraid/logwatch/dmeventd +++ - 2010-01-11 15:18:13.643886000 +0000 @@ -0,0 +1,89 @@ +######################################################################## +# Copyright (C) 2007-2008, Intel Corp. All rights reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +######################################################################## + +######################################################## +# dmeventd +######################################################## + +######################################################## +# This was written by: +# Brian Wood +# +# Changes to get it to work: +# Heinz Mauelshagen +# +# Needs more tweking to deal with absolute timestamp timestamps properly +# in order to avoid mismatches in the log file being displayed!!! +# +# +######################################################## + +# Set the location of the folder to store last time stamp +# (This is used to record the last log sent out so repeats +# are not mailed in error.) +$syslogpattern_file = + "/etc/logwatch/scripts/services/dmeventd_syslogpattern.txt"; + +if (-e $syslogpattern_file) { + open(FD, "+<", $syslogpattern_file) or die $!; + $last_pattern = join('', ); +} else { + open(FD, ">", $syslogpattern_file) or die $!; + $last_pattern = ""; +} + +# SAMPLE LOG DATA: +# Oct 15 01:14:33 dmraid-devhost dmeventd[24857]: Processing device \ +# "isw_febiihjha_Volume0" for events +@entries = (); +@pattern = (); + +while (<>) { + ($month, $day, $time, $message) = split(' ', $_, 4); + ($m, $d, $t, $mes) = split(' ', @pattern[0], 4); + if ($time ne $t) { + @pattern = (); + } + + # New pattern. + push (@pattern, $_); + push (@entries, $_); + + if (join('', @pattern) eq $last_pattern) { + @entries = (); + @pattern = (); + $last_pattern = ""; + } +} + +if ($#entries > -1) { + print("There were a total of ", $#entries + 1, " new log entries\n\n"); + print("Date Message\n"); + print("-" x 80, "\n"); + print @entries; + + # Now save current pattern. + close(FD); + open(FD, ">", $syslogpattern_file) or die $!; + printf FD join('',@pattern); +} + +close(FD); +exit(0); + +# vi: shiftwidth=3 syntax=perl et /cvs/dm/dmraid/logwatch/dmeventd.conf,v --> standard output revision 1.1 --- dmraid/logwatch/dmeventd.conf +++ - 2010-01-11 15:18:13.754495000 +0000 @@ -0,0 +1,31 @@ +######################################################################## +# Copyright (C) 2007-2008, Intel Corp. All rights reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +######################################################################## + +################################################################## +# +# dmeventd script ver. 0.0.1 for Logwatch. +# +# Written by B. Wood +# +################################################################## + +Title = "Dmeventd Errors" +LogFile = messages +*OnlyService = dmeventd + +# vi: shiftwidth=3 tabstop=3 et /cvs/dm/dmraid/logwatch/dmeventd_cronjob.txt,v --> standard output revision 1.1 --- dmraid/logwatch/dmeventd_cronjob.txt +++ - 2010-01-11 15:18:13.952920000 +0000 @@ -0,0 +1,2 @@ +# |DMEVENTD| This will run logwatch checking for dmeventd events every minute. +# * * * * * /usr/sbin/logwatch --service dmeventd --range today --detail med /cvs/dm/dmraid/logwatch/logwatch.conf,v --> standard output revision 1.1 --- dmraid/logwatch/logwatch.conf +++ - 2010-01-11 15:18:14.067861000 +0000 @@ -0,0 +1,26 @@ +######################################################################## +# Copyright (C) 2007-2008, Intel Corp. All rights reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +######################################################################## + +# Local configuration options go here (defaults are in /usr/share/logwatch/default.conf/logwatch.conf) +MailTo = root +# To send email to an external user change "root" to something like: guest@anonymous.com +mailer = "/usr/sbin/sendmail -t" +LogDir = /var/log +MailFrom = Logwatch +Range = Today +Detail = Med