title: Fetch Exceptions from logs along with stacktrace
body: <p>I am trying to fetch exceptions from the logs along with StackTrace.
  The logs are in the format given below.</p>
  
  <pre><code>[2015-01-07 18:39:18,212] host123 WARN com.host123 .elf.UserQuest - Quest/option {o.q.more.paper.osc#0} references unknown dependent {t.what.form.file.more.action} in application {src-code}. Please revise.
  [2015-01-07 18:39:18,212] host123 WARN com.host123 .elf.UserQuest - Quest/option {o.q.more.paper.osc#1} references unknown dependent {t.what.form.file.more.action} in application {src-code}. Please revise.
  [2015-01-07 18:40:34,281] cessor32 ERROR com.host123 .email.DirectMailer - Unable to connect to server {1.1.1.1}:
         javax.mail.MessagingException: Could not connect to SMTP host: 1.1.1.1, port: 25, response: 451
         at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:996)
         at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:197)
         at javax.mail.Service.connect(Service.java:233)
         at javax.mail.Service.connect(Service.java:134)
         at com.host123.email.DirectMailer.deliverMessage(DirectMailer.java:191)
         at com.host123.email.DirectMailer.send(DirectMailer.java:153)
         at com.host123.webface.util.Notifications.sendEmailX(Notifications.java:126)
         at com.host123.webface.util.Notifications.sendEmail(Notifications.java:91)
         at com.host123.webface.util.Notifications.sendEmail(Notifications.java:145)
         at com.host123.edp.webface.action.DocRecoveryActionProcessor.perform(DocRecoveryActionProcessor.java:81 )
  </code></pre>
  
  <p>I am using this code to fetch the records</p>
  
  <pre><code>sed -n '/${bb}/,/${aa}/p' ${k}|egrep "ERROR|ORA|Exception|at.*\.java\:.*"
  </code></pre>
  
  <p>where bb is the previous date and aa is the current date.
  If I use only sed command than I am able to fetch the details based on date condition but using egrep along with sed gives no output.</p>
  
  <p>I also tried using awk command.</p>
  
  <pre><code>awk -v "sd=$aa" -v "ed=$bb" -F "," '$1 &gt;= sd &amp;&amp; $1 &lt;= ed' $k
  </code></pre>
  
  <p>What I think might be the problem is that awk command fetches the line which have date in it and StackTrace row does not have any row. It might or might not be correct.</p>
  
  <p>Also I am fetching this from thousands of log files If there is any way to reduce the amount of memory used for fetched data will be very useful.<br>
  Any help will be greatly appreciated.</p>