logfile parsing

I thought I was pretty handy with awk until I got this one. :slight_smile:

I'm trying to parse a log file where the events could have different delimiters (2 scripts is ok), the errors are spread over multiple lines, and I"m trying to figure out how to not read the same lines that have already been read.

The purpose being that when the script sees something the output will be redirected to mail/snmptrap/etc.

11/13/2009 1:05:28 PM ---------------------------------------------------------
11/13/2009 1:05:52 PM FTP Error: The password was not allowed
11/13/2009 1:05:52 PM Agile ChangeCAST failed for the following reason:^M
FTP Error: The password was not allowed
11/13/2009 1:05:52 PM There were errors found on profile <1>. The profile will be set as disabled.
11/13/2009 1:05:52 PM ---------------------------------------------------------
11/13/2009 1:28:09 PM *************** JVM Error ***************
11/13/2009 1:28:09 PM Nov 13, 2009 1:28:08 PM oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER^M
WARNING: Exception returned by remote server: {0}^M
java.lang.NoClassDefFoundError: Lcom/agile/common/client/value/VOAudit;^M
        at java.lang.Class.getDeclaredFields0(Native Method)^M
        at java.lang.Class.privateGetDeclaredFields(Class.java:2232)^M
        at java.lang.Class.getDeclaredField(Class.java:1852)^M
        at java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1555)^M
        at java.io.ObjectStreamClass.access$600(ObjectStreamClass.java:47)^M
        at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:381)^M
        at java.security.AccessController.doPrivileged(Native Method)^M
        at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:373)^M
        at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:268)^M
        at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:504)^M
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)^M
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)^M
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)^M
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)^M
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)^M
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)^M
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)^M
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)^M
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)^M
        at com.evermind.server.rmi.RMIClientConnection.handleMethodInvocationResponse(RMIClientConnection.java:856)^M
        at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:287)^M
        at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:242)^M
        at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:224)^M
        at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)^M
        at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)^M
        at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)^M
        at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)^M
        at java.lang.Thread.run(Thread.java:595)^M
java.lang.NoClassDefFoundError: Lcom/agile/common/client/value/VOAudit;^M
        at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)^M
        at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:125)^M
        at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:517)^M
        at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:461)^M
        at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)^M
        at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)^M
        at com.evermind.server.ejb.StatefulSessionRemoteInvocationHandler.invoke(StatefulSessionRemoteInvocationHandler.java:31)^M
        at __Proxy1.sendObject(Unknown Source)^M
        at com.agile.changecast.agileobjects.bridge.AgileObjectsBridge.sendObject(AgileObjectsBridge.java:542)
11/13/2009 1:28:09 PM *****************************************
11/13/2009 2:09:39 PM FTP: PutFile failed to upload CPIMAST015788: 200.
11/13/2009 2:09:39 PM An unknown error has occurred, please notify your system administrator. ChangeCAST will now exit.

OK how about the best way to find the profile errors over a certain time-frame? For example if I ran the script every 15 minutes and count the times the profile alert happened.