Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to scrape multiple log files for an exception
    primarykey
    data
    text
    <p>I'm writing a node.js function to ssh to a remote machine, and attempt to scrape logs for exceptions from a variety of different log files. The important bit of the log file will look something like this:</p> <pre><code>.... gunk .... 2013-01-29 04:06:39,133 com.blahblah.BaseServlet processRequest Thread-1629 Site-102 Cons-0 Url-http://theurlthat.com/caused/the/problem App-26 yada yada yada java.lang.NullPointerException at com.blahblah.MyClass.hi(MyClass.java:173) at com.blahblah.StandardStackTrace.main(StandardStackTrace.java:125) at com.blahblah.SoOnAndSo.forth(SoOnAndSo.java:109) at java.lang.Thread.run(Thread.java:595) 2013-01-29 04:06:39,133 com.blahblah.BaseServlet defaultThrowableHandler Thread-1629 Site-102 Cons-0 Url-http://theurlthat.com/caused/the/problem App-26 yad yada yada TechnicalDifficultiesException: TD page delivered by handleThrowable http://theurlthat.com/caused/the/problem ....more gunk.... </code></pre> <p>I need to find the exception and corresponding date in the log file that meets the following three requirements:</p> <ol> <li><p>The exception must be the first that precedes this static text: </p> <p>TechnicalDifficultiesException: TD page delivered by handleThrowable</p></li> <li><p>The Exception must be directly between two lines that have "BaseServlet.*Site-102"</p></li> <li><p>The exception must be the most recent (last) in the log files that meets the above conditions. The log is rolled over periodically, so it need to be the last in Log, or if that doesn't exist the last in Log.001, or if that doesn't exist the last in Log.002, etc.</p></li> </ol> <p>Since this program has to ssh into one of many potential servers, it's better to only have to maintain the logic in the node.js program and not on the machines with the logs. Thus, a one-liner in perl/sed/awk/grep/etc would be most ideal.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload