I have a log file that contrains entries like following:
[08/30/19 16:00:01:001 EDT] [SRNotes_Worker-1] INFO com.emc.clm.srnotes.schedule.SRNotesItemProcessor Started processing the SrTriageFile instance with ID 38 and file ID 250339290
[08/30/19 16:00:01:001 EDT] [SRNotes_Worker-1] TRACE org.springframework.jdbc.core.StatementCreatorUtils Setting SQL statement parameter value: column index 2, parameter value [73651266], value class [java.lang.String], SQL type unknown
What would be the regex pattern that I can use for extracting all the relevant fields as following
Timestamp: [08/30/19 16:00:01:001 EDT]
Thread: [SRNotes_Worker-1]
Level: INFO
Class: com.emc.clm.srnotes.schedule.SRNotesItemProcessor
Message: Started processing the SrTriageFile instance with ID 38 and file ID 250339290
I have written a function that goes through each character of the string and checks for '[', spaces and other rules like such. Based on that I split the log entries. But I know that it's not an elegant solution. I should use regex but I do not have enough idea about it.