Re: Is awk the solution ?

From: damir delija (ddelija@SRCE.HR)
Date: Sat Feb 01 2003 - 07:01:30 EST


On Fri, Jan 31, 2003 at 10:55:17AM -0500, Bruno Misseeuw wrote:
> Hi,
>
> I'm trying to figure out what the best method is to get information out of
> a log file (see copy paste below). I believe the awk command to be the
> solution, but I'm not sure what the best approach is, as I'm far from an
> awk expert. You could say that the lines below represent one record.

Hi !
I suppose you are on AIX
there are some logchekers and logtestrs in perl
You have perl already on AIX
so try with some logcheker/loganalyzer
witch can be programmed to check out patterns
check on the CPAN for such modules or on the stockley consulting

Awk is also capable of such operations but if you are begginer
it is better to jump directly on perl

I hope this helps

Damir Delija

>
>
> 1~14907~65537~1043994054(Jan 31 01:20:54 2003)
> ### EVENT ###
> TMW_Clearing;modelname="mySAP_Buffer";profilename="us6db101_DB1_03.mySAP
> App Server Performance#us6dem01-region";eventname
> ="SAP_Buffer_Quality";eventid="1043986250625";event_key
> ="SAP_Buffer_Quality|sub_origin=us6db101_DB1_03;buffername=PXA;";slotkey
> ="SAP_Buffer_Quality|sub_origin=us6db101_DB1_03;buffername=PXA;";severity
> ="HARMLESS";application_class="mySAPAppServer";application_oid
> ="1473274733.1.1063";application_label
> ="us6db101_DB1_03";application_version="5.1.0";distrib_admin
> ="Root_us6dem01-region";hostname="us6db101";origin
> ="167.105.8.4";adapter_host="us6db101";date="01/31/2003 1:20:49 AM";msg
> ="The problem described by SAP_Buffer_Quality no longer exists.";END
>
> ### END EVENT ###
>
> So my question is to any of those awk guru's out there how would you do
> this, or do you recommend another approach ? What I need is the
> time/datestamp out of the first line and then a few fields out of the line
> which has the ; as a separator. I would then output these fields to a new
> file and import the file into excel.
>
> Ideally the output would need to be something like :
> Jan 31 01:20:54 2003<TAB>TMW_Clearing<TAB>us6db101<TAB>The problem
> described by SAP_Buffer_Quality no longer exists
>
> The date and time comes from line 1. TMW_Clearing is the first field on
> the line after ###EVENT###, hostname is ie. field number 10, msg field
> number 15...
>
>
> Best Regards,
> Bruno Misseeuw
> Coca-Cola Enterprises
>
> *****************************************************************************************************************************************************************************************
>
> This message is intended for the use of the individual or entity to which
> it is addressed and may contain information that is confidential and
> privileged and exempt from disclosure under applicable law. If the reader
> of this message is not the intended recipient, you are hereby notified that
> any dissemination, distribution, or copying of this communication is
> strictly prohibited. If you have received this communication in error,
> please contact the sender immediately and delete it from your system.
> Thank you
> *****************************************************************************************************************************************************************************************



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:33 EDT