I need to create a regular expression in python that can take the following sample and split out each log entry. I'm using the date as a way to identify the beginning of each log entry but it is only able to get a single line from where the date starts to the end of the first line. It completely misses all of the stack trace stuff. I want all of the log entry because there is a lot of repeated logging and I want to be able to filter out repeats and just reduce it down to a handful of unique log entries. I would also want to be able to remove anything unique about the string like date timestamp once I've identified a log entry so that a comparison function could flag it as a duplicate. I've tried to use positive lookaheads and multiline flags but to no avail. Anyone know what I am trying to do?
Some regular expressions I've tried
^\d{4}-\d{2}-\d{2}.*\(.*\)$ // it matches single line date to parenthesis
^(\d{4}-\d{2}-\d{2}|\s|).*\)$ // matches single line with tabs - not much better
^\d{4}-\d{2}-\d{2}.*(?=\d{4}-\d{2}-\d{2}) // positive lookahead but barely works
Sample string:
2018-03-06 11:36:40:048 INFO:Starting. (com.X.s.f.o.o)
2018-03-06 11:36:42:931 SEVERE: Error attempting to s: StatusRuntimeException (com.Y.W.Z_H.ZHGC.sHToVe)
io.G.StatusRuntimeException: EXCEEDED
at io.G.stub.CCalls.toStatusRuntimeException(CCalls.java:227)
at io.G.stub.CCalls.getUnchecked(CCalls.java:208)
at io.G.stub.CCalls.blockingUnaryCall(CCalls.java:141)
2018-03-06 11:36:46:159 SEVERE: Error attempt: StatusRuntimeException (com.Y.W.Z_H.ZHGC.sHToVe)
io.G.StatusRuntimeException: EXCEEDED
at io.G.stub.CCalls.toStatusRuntimeException(CCalls.java:227)
at io.G.stub.CCalls.getUnchecked(CCalls.java:208)
at io.G.stub.CCalls.blockingUnaryCall(CCalls.java:141)
2018-03-06 11:36:46:824 SEVERE: getConfigInteger(): eGSWindowsPortNumber (com.Y.W.Y_Z_config_s.YZConfigs.getInteger)
2018-03-06 11:36:46:844 SEVERE: Failed to get (com.Y.W.Z_H.ZHGC.create)
Desired output:
Match 1:
INFO:Starting. (com.X.s.f.o.o)
Match 2:
SEVERE: Error attempting to s: StatusRuntimeException (com.Y.W.Z_H.ZHGC.sHToVe)
io.G.StatusRuntimeException: EXCEEDED
at io.G.stub.CCalls.toStatusRuntimeException(CCalls.java:227)
at io.G.stub.CCalls.getUnchecked(CCalls.java:208)
at io.G.stub.CCalls.blockingUnaryCall(CCalls.java:141)
Match 3:
SEVERE: Error attempt: StatusRuntimeException (com.Y.W.Z_H.ZHGC.sHToVe)
io.G.StatusRuntimeException: EXCEEDED
at io.G.stub.CCalls.toStatusRuntimeException(CCalls.java:227)
at io.G.stub.CCalls.getUnchecked(CCalls.java:208)
at io.G.stub.CCalls.blockingUnaryCall(CCalls.java:141)
Match 4:
SEVERE: getConfigInteger(): eGSWindowsPortNumber (com.Y.W.Y_Z_config_s.YZConfigs.getInteger)
Match 5:
SEVERE: Failed to get (com.Y.W.Z_H.ZHGC.create)