Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have a tomcat log file that I need to parse. It looks like a regular tomcat log:
[datestamp] [DEBUG] something here [datestamp] [DEBUG] something else here [datestamp] [ERROR] blah blah <chunk of crap> [datestamp] [INFO] bla bla bla
what I need to do is parse this thing, and regard the [datestamp] as the start of a 'chunk' and the next [datestamp] 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 [datestamp #1] and [datestamp #2] contains a specific string. any ideas? edit: real snippet of the log file to be parsed:
[Wed Aug 04 00:10:40.591 2010] [DEBUG] [TP-Processor19, time=128089504 +0587, uri=/ibdsupport/workflow/webapp/workflow/coordinator/gotoCoordi +natorNew.cb2] [com.boylesoftware.cb2.BLOBJT.cache]: [208973459] Retri +eve cached object 'segmentProp.map' for segment 142 [Wed Aug 04 00:10:40.591 2010] [DEBUG] [TP-Processor19, time=128089504 +0587, uri=/ibdsupport/workflow/webapp/workflow/coordinator/gotoCoordi +natorNew.cb2] [com.boylesoftware.cb2.BLOBJT.cache]: [208973459] Retri +eve cached object 'segmentProp.map' for segment 142 [Wed Aug 04 00:10:40.666 2010] [ERROR] [TP-Processor19, time=128089504 +0587, uri=/ibdsupport/workflow/webapp/workflow/coordinator/gotoCoordi +natorNew.cb2] [com.boylesoftware.cb2.DAOBJT]: [208973534] Got an erro +r executing query "fetchJobQueueTime" chunk "5". com.boylesoftware.cb2.BLException: Database error in the DAO. at com.boylesoftware.cb2.DAO.executeUpdate_Internal(DAO.java:248 +3) [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) [cb +2ms.jar:na] at com.boylesoftware.cb2.DAO.fetchWithNamedParams(DAO.java:272 +1) [cb2ms.jar:na] at com.boylesoftware.cb2.DAO.fetchWithNamedParams(DAO.java:382 +6) [cb2ms.jar:na] at com.somecompany.insidetrack.tt.project.ProjConsoleBLO.fetch +JobQueueTime(ProjConsoleBLO.java:527) [ProjConsoleBLO.class:na] at com.somecompany.insidetrack.tt.presentation.workflow.JobOve +rviewListPE.init(JobOverviewListPE.java:221) [JobOverviewListPE.class +:na] at com.boylesoftware.cb2.presentation.servlet.ShowPageAction.e +xecute(ShowPageAction.java:141) [cb2ms.jar:na] at com.boylesoftware.cb2.presentation.servlet.CB2Action.execut +e(CB2Action.java:205) [cb2ms.jar:na] at org.apache.struts.action.RequestProcessor.processActionPerf +orm(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 '#projJ +ob' 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 cor +relation name which must be used instead. (DataSource: insidetrack-db, Type: SYBASE) [Wed Aug 04 00:10:40.666 2010] [DEBUG] [TP-Processor19, time=128089504 +0587, uri=/ibdsupport/workflow/webapp/workflow/coordinator/gotoCoordi +natorNew.cb2] [com.boylesoftware.cb2.DAOBJT]: [208973534] executing c +hunk "6" with a timeout of 360 seconds
Code would need to go through these "chunks", find the "DBPoolSQLException" and associate it with the appropriate datestamp it appears under ([Wed Aug 04 00:10:40.666 2010])

In reply to Parsing a file in "chunks" by vxp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-23 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found