Joralf

LOGMON: FormatRules end expression, need advice regarding Regex

Discussion created by Joralf on May 4, 2014
Latest reply on Mar 4, 2016 by Tomas Vrbka

Hi

 

I'm struggling to get the correct textblock on some of my logfiles.

 

Example of textblock i want the Format Rules to pick up:

03.05.2014 00.46.02.828             Error    Exception occured:, System.Data.SqlClient.SqlException: 'Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.'
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
03.05.2014 00.46.10.234       Information    Start - VerifyRegistration

 

I want the format rule start on the first line of the Error-line, and include the last line of the exception. I've been trying to use the fact that all the exception-lines start with 3 whitespaces, but my regex-skills hav'nt proven good enough. Initially I included the next line with timestamp and Information/Error, but that can make me miss errors.

A additional thing causing me to struggle is that it's not always exceptions on the errors. I don't want to miss those either.

 

Do any of you see any way to achieve this?

I tried using multiple watchers, but could'nt get that to work either.

 

Hope someone has a hint/tip on how to accomplish this.

 

EDIT:

I've tried using lookahead in regex, so I dont include the linje I get a match on. No luck so far.

Dont seem to match blank line in regex either. I thougt i could use \z|\Z, but cant get that to work either. Seems like I'm currently out of luck here.

Outcomes