#!/usr/bin/perl -w
##########################################################################
# $Id: onlyservice,v 1.2 1998/02/23 01:17:03 kirk Exp $
##########################################################################
# $Log: onlyservice,v $
# Revision 1.2  1998/02/23 01:17:03  kirk
# Getting ready for a first distribution
#
# Revision 1.1  1998/02/22 23:28:28  kirk
# Commented and rearranged some things
#
##########################################################################

########################################################
# This was written and is maintained by:
#    Kirk Bauer <kirk@kaybee.org>
#
# Please send all comments, suggestions, bug reports,
#    etc, to kirk@kaybee.org.
#
########################################################

# This will pick out only the wanted service from a logfile
# in the standard /var/log/messages format.  Case insensitive.

if ( $ENV{'LOGWATCH_DEBUG'} > 5 ) {
   print STDERR "DEBUG: Inside OnlyService...\n";
}

$ServiceName = $ARGV[0];

while (defined($ThisLine = <STDIN>)) {
    if ($ThisLine =~ m/^... .. ..:..:.. [^ ]* $ServiceName\[[0123456789]*\]: /io) {
      print $ThisLine;
    }
    elsif ($ThisLine =~ m/^... .. ..:..:.. [^ ]* $ServiceName: /io) {
      print $ThisLine;
    }
}
