perlquestion
vxp
I have a tomcat log file that I need to parse.
It looks like a regular tomcat log:
<code>
[datestamp] [DEBUG] something here
[datestamp] [DEBUG] something else here
[datestamp] [ERROR] blah blah
<chunk of crap>
[datestamp] [INFO] bla bla bla
</code>
what I need to do is parse this thing, and regard the <code>[datestamp]</code> as the start of a 'chunk' and the next <code>[datestamp]</code> as the end of the previous chunk (and, obviously, a beginning of a new chunk)
In essence, I need to check if the <chunk of crap> between <code>[datestamp #1]</code> and <code>[datestamp #2]</code> contains a specific string.
any ideas?
edit:
real snippet of the log file to be parsed:
<code>
[Wed Aug 04 00:10:40.591 2010] [DEBUG] [TP-Processor19, time=1280895040587, uri=/ibdsupport/workflow/webapp/workflow/coordinator/gotoCoordinatorNew.cb2] [com.boylesoftware.cb2.BLOBJT.cache]: [208973459] Retrieve cached object 'segmentProp.map' for segment 142
[Wed Aug 04 00:10:40.591 2010] [DEBUG] [TP-Processor19, time=1280895040587, uri=/ibdsupport/workflow/webapp/workflow/coordinator/gotoCoordinatorNew.cb2] [com.boylesoftware.cb2.BLOBJT.cache]: [208973459] Retrieve cached object 'segmentProp.map' for segment 142
[Wed Aug 04 00:10:40.666 2010] [ERROR] [TP-Processor19, time=1280895040587, uri=/ibdsupport/workflow/webapp/workflow/coordinator/gotoCoordinatorNew.cb2] [com.boylesoftware.cb2.DAOBJT]: [208973534] Got an error executing query "fetchJobQueueTime" chunk "5".
com.boylesoftware.cb2.BLException: Database error in the DAO.
at com.boylesoftware.cb2.DAO.executeUpdate_Internal(DAO.java:2483) [cb2ms.jar:na]
at com.boylesoftware.cb2.DAO.executeNamedQuery(DAO.java:2634) [cb2ms.jar:na]
at com.boylesoftware.cb2.DAO.fetch_Internal(DAO.java:2524) [cb2ms.jar:na]
at com.boylesoftware.cb2.DAO.fetchWithNamedParams(DAO.java:2721) [cb2ms.jar:na]
at com.boylesoftware.cb2.DAO.fetchWithNamedParams(DAO.java:3826) [cb2ms.jar:na]
at com.somecompany.insidetrack.tt.project.ProjConsoleBLO.fetchJobQueueTime(ProjConsoleBLO.java:527) [ProjConsoleBLO.class:na]
at com.somecompany.insidetrack.tt.presentation.workflow.JobOverviewListPE.init(JobOverviewListPE.java:221) [JobOverviewListPE.class:na]
at com.boylesoftware.cb2.presentation.servlet.ShowPageAction.execute(ShowPageAction.java:141) [cb2ms.jar:na]
at com.boylesoftware.cb2.presentation.servlet.CB2Action.execute(CB2Action.java:205) [cb2ms.jar:na]
at org.apache.struts.action.RequestProcessor.processActionPerform(Unknown Source) [struts.jar:1.1]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_16]
Caused by: msjava.dbpool.DBPoolSQLException: The column prefix '#projJob' does not match with a table name or alias name used in the query. Either the table is not specified in the FROM clause or it has a correlation name which must be used instead.
(DataSource: insidetrack-db, Type: SYBASE)
[Wed Aug 04 00:10:40.666 2010] [DEBUG] [TP-Processor19, time=1280895040587, uri=/ibdsupport/workflow/webapp/workflow/coordinator/gotoCoordinatorNew.cb2] [com.boylesoftware.cb2.DAOBJT]: [208973534] executing chunk "6" with a timeout of 360 seconds
</code>
Code would need to go through these "chunks", find the "DBPoolSQLException" and associate it with the appropriate datestamp it appears under (<code>[Wed Aug 04 00:10:40.666 2010]</code>)