<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic search syslog for errors with perl in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/search-syslog-for-errors-with-perl/m-p/2866958#M721550</link>
    <description>Hi &lt;BR /&gt;I have a perl script which searches syslog for error message.In this case i have just used "vmunix" but what i want to be able to do is only list error's for set date.&lt;BR /&gt;&lt;BR /&gt;For example if i run script now it will only check for messages in the last 24 hours.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Simon</description>
    <pubDate>Wed, 18 Dec 2002 15:56:27 GMT</pubDate>
    <dc:creator>simon peter</dc:creator>
    <dc:date>2002-12-18T15:56:27Z</dc:date>
    <item>
      <title>search syslog for errors with perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-syslog-for-errors-with-perl/m-p/2866958#M721550</link>
      <description>Hi &lt;BR /&gt;I have a perl script which searches syslog for error message.In this case i have just used "vmunix" but what i want to be able to do is only list error's for set date.&lt;BR /&gt;&lt;BR /&gt;For example if i run script now it will only check for messages in the last 24 hours.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Simon</description>
      <pubDate>Wed, 18 Dec 2002 15:56:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-syslog-for-errors-with-perl/m-p/2866958#M721550</guid>
      <dc:creator>simon peter</dc:creator>
      <dc:date>2002-12-18T15:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: search syslog for errors with perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-syslog-for-errors-with-perl/m-p/2866959#M721551</link>
      <description>Here's one I wrote:&lt;BR /&gt;This requires 2 additional files, one of which is a "filter" file, and the other a list of email addys.   &lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;# Loganalyzer&lt;BR /&gt;# July 2002 by C. Vail&lt;BR /&gt;&lt;BR /&gt;# Analyze system logs and email the results&lt;BR /&gt;# Arguments to the grep -v command should be placed in &lt;BR /&gt;# $FFILE.  These is a simple text file with one argument per line.&lt;BR /&gt;&lt;BR /&gt;IAM=`uname -n`&lt;BR /&gt;PPATH=/root/work/logs                   # Path to this file&lt;BR /&gt;LPATH=/var/adm/syslog                   # Path to the log file&lt;BR /&gt;MFILE=$PPATH/loganalyzer.mail           # List of email addys&lt;BR /&gt;FFILE=$PPATH/loganalyzer.filters        # Filter file&lt;BR /&gt;LFILE=$LPATH/syslog.log                 # Log file name&lt;BR /&gt;TFILE=$PPATH/loganalyzer.tmp            # Temporary files&lt;BR /&gt;UFILE=$PPATH/loganalyzer.tmp2&lt;BR /&gt;&lt;BR /&gt;if test -f $TFILE&lt;BR /&gt;then&lt;BR /&gt;        rm $TFILE&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# This script is designed to run a minute after midnight each day.&lt;BR /&gt;# Hence, we need yesterday's date.  This gets tricky because of &lt;BR /&gt;# end of month and year considerations.&lt;BR /&gt;TMONTH=`date -u +%m`&lt;BR /&gt;TDAY=`date -u +%d`&lt;BR /&gt;&lt;BR /&gt;if test "$TDAY" = "01"&lt;BR /&gt;then&lt;BR /&gt;        case $TMONTH in&lt;BR /&gt;        01)     MONTH=Dec;YSDAY=31;;&lt;BR /&gt;        02)     MONTH=Jan;YSDAY=31;;&lt;BR /&gt;        03)     MONTH=Feb;YSDAY=28;;&lt;BR /&gt;        04)     MONTH=Mar;YSDAY=31;;&lt;BR /&gt;        05)     MONTH=Apr;YSDAY=30;;&lt;BR /&gt;        06)     MONTH=May;YSDAY=31;;&lt;BR /&gt;        07)     MONTH=Jun;YSDAY=30;;&lt;BR /&gt;        08)     MONTH=Jul;YSDAY=31;;&lt;BR /&gt;        09)     MONTH=Aug;YSDAY=31;;&lt;BR /&gt;        10)     MONTH=Sep;YSDAY=30;;&lt;BR /&gt;        11)     MONTH=Oct;YSDAY=31;;&lt;BR /&gt;        12)     MONTH=Nov;YSDAY=30;;&lt;BR /&gt;        esac&lt;BR /&gt;else&lt;BR /&gt;        YSDAY=`echo "$TDAY - 1"|bc`&lt;BR /&gt;        MONTH=`date -u +%b`&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;case $YSDAY in&lt;BR /&gt;        1)      DAY=" 1";;&lt;BR /&gt;        2)      DAY=" 2";;&lt;BR /&gt;        3)      DAY=" 3";;&lt;BR /&gt;        4)      DAY=" 4";;&lt;BR /&gt;        5)      DAY=" 5";;&lt;BR /&gt;        6)      DAY=" 6";;&lt;BR /&gt;        7)      DAY=" 7";;&lt;BR /&gt;        8)      DAY=" 8";;&lt;BR /&gt;        9)      DAY=" 9";;&lt;BR /&gt;        *)      DAY=$YSDAY&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;grep "$MONTH $DAY" $LFILE&amp;gt;$TFILE&lt;BR /&gt;&lt;BR /&gt;NUM1=`wc -l $TFILE|awk '{ print $1 }'`&lt;BR /&gt;&lt;BR /&gt;for FILTER in `cat $FFILE`&lt;BR /&gt;do&lt;BR /&gt;        cat $TFILE|grep -v $FILTER&amp;gt;$UFILE&lt;BR /&gt;        mv $UFILE $TFILE&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;pr -n -t $TFILE&amp;gt;$UFILE&lt;BR /&gt;mv $UFILE $TFILE&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NUM2=`wc -l $TFILE|awk '{ print $1 }'`&lt;BR /&gt;NUM3=`echo "$NUM1 - $NUM2"|bc`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;echo "Total Lines: $NUM1 Filtered: $NUM3"&amp;gt;&amp;gt;$TFILE&lt;BR /&gt;&lt;BR /&gt;for ADDY in `cat $MFILE`&lt;BR /&gt;do&lt;BR /&gt;        cat $TFILE|mailx -s "{SYSLOG} $IAM" Logs for $MONTH $DAY" $ADDY&lt;BR /&gt;done</description>
      <pubDate>Thu, 19 Dec 2002 00:09:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-syslog-for-errors-with-perl/m-p/2866959#M721551</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2002-12-19T00:09:16Z</dc:date>
    </item>
  </channel>
</rss>

