Register
It is currently Wed Sep 17, 2014 5:33 am

Extracting MAIL data from Lotus Notes log file


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Mon Apr 09, 2012 10:48 pm   

Joined: Tue Apr 03, 2012 8:22 pm
Posts: 4
Hi, First post to this forum.
Need some help to gather the following information from Lotus Notes log files.
I need to search maillogs and grep out anything which took more than 2 minutes and a total of all mail

Can anyone provide any 1 liners which may capture :

anything above 00:02:00
and total of lines/emails in the logfile.

,Size:,1K,Time:,00:00:01,Hop,Count:,2

My script is mostly echoing and then crunching the lines
Starting,to,Analyse,logs,at,Tue,May,,1,11:41:45,NZST,2012
Start,Date,=,,20/03/2012,09:10:45,Router:
End,Date,=,,20/03/2012,09:11:26,Router:
Crunching,,210,,lines


So it shows how many lines are crunched which is 1 step done.
Just need to grep out the +2Mins

Any help on a 1 liner would be much appreciated.
Last request was too much


Last edited by cozcol on Mon Apr 30, 2012 5:47 pm, edited 3 times in total.

Top
 Profile  
 PostPosted: Tue Apr 10, 2012 11:09 am   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
This sounds like a fun project for bash or Perl! What have you tried so far?
You could almost certainly use awk to gather your numbers. You'd probably want to do your math separately. I can think of a few ways to approach this.


Top
 Profile YIM  
 PostPosted: Tue Apr 10, 2012 4:29 pm   

Joined: Tue Apr 03, 2012 8:22 pm
Posts: 4
Thanks for the prompt reply.

Your ideas would be much appreciated as I have only managed some re-direction.

Trying to apply some awk or sed for output but to do the sums I am trying to work out.

I'm trying some Perl 1 liner scripts which just strip the data out. As these logs have a lot of info

perl -wne'while(/[\w\.]+@[\w\.]+/g){print "$&\n"}' test.txt

perl -wne'while(/[\w\.]+@[\w\.]+\w+/g){print "$&\n"}' test.txt

perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}' emails.txt | sort -u > output.txt

These can strip out the emails, but I need to get the time columns and size, so awk is preferable for that I'm thinking.

If someone can provide a script to awk out the 5 relevant columns into another file for safe keeping that would be a good start


Top
 Profile  
 PostPosted: Wed Apr 11, 2012 5:48 pm   

Joined: Tue Apr 03, 2012 8:22 pm
Posts: 4
This is what I have so far.

[size=90]#!/bin/sh
MAILLOG=/root/logs/notes.log
OUTPUTFILE=mylog.txt

echo "Starting to Analyse logs at `date`" > $OUTPUTFILE
echo "Start Date = " `head -1 $MAILLOG | awk '{ print $1, $2, $3 }'` >> $OUTPUTFILE
echo "End Date = " `tail -1 $MAILLOG | awk '{ print $1, $2, $3 }'` >> $OUTPUTFILE
echo "Crunching " `wc -l $MAILLOG | awk '{ print $1 }'` " lines" >> $OUTPUTFILE
echo >> $OUTPUTFILE
echo "==================" >> $OUTPUTFILE
echo >> $OUTPUTFILE
echo "======= Host not found ========" >> $OUTPUTFILE

echo >> $OUTPUTFILE
echo "=> Domains associated with Host Not found" >> $OUTPUTFILE
grep "Host not found" $MAILLOG | sed -e 's/.*for name=//' | sed -e 's/ type=.*//' | sort | uniq -c >> $OUTPUTFILE
echo "==================" >> $OUTPUTFILE


so nothing yet on +2 MINS.

any advice?


Last edited by cozcol on Mon Apr 30, 2012 5:49 pm, edited 1 time in total.

Top
 Profile  
 PostPosted: Wed Apr 18, 2012 5:42 pm   

Joined: Tue Apr 03, 2012 8:22 pm
Posts: 4
Hi jeo, could you post you ideas so i could have a look. In need of some inspiration.
Thankyou for your reply


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP