How to Use C# Regular Expressions to Parse Log File?

I have an application log that I would like to parse into individual log entries that can be displayed to an end user. I have attached an actual log file along with a Word document containing  descriptions of the fields I would like to capture.

As you can see from the example, each log entry begins with a date field with the following format:[yyyy-mm-dd]
The remainder of the log entry is delimited by "|" and ends at the date field of the succeeding entry. I would like to use regular expressions to split the log file into individual entries using the date field as a delimeter and for each entry I would like to capture the fields described in the example document.
The intention is for the end user to be able to sort and filter the log entries based on the caputure fields while formatting the displayed result.
So the goal is to:

1) Create a regular expression object to split the log into indivdual entries using the date field (which also needs to be captured)
2) Create a regular expression object to capture the required data from each log entry that was created as a result of the first step.

It would take me days, if not weeks to figure this out on my own. I was hoping one of the Regex gurus could provide some assistance. Many thanks!!!
Who is Participating?
ddrudikConnect With a Mentor Commented:
There are numerous parts to your question, but to get you started, this regex pattern worked for me:
jandrews404Author Commented:
This works perfect........I need you on retainer.
One quick question...
There is an exception message in the stack trace portion of most, but not all, of the log entries. It is always at the end and always begins with ">". Can you show me an example of how to capture this message? I've attached another document highlighting the message.

See if this matches what you need:
jandrews404Author Commented:
you are the regex Master!
Thanks for the question and the points.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.