JREPL command to move loglines that dont start with a date/timestamp to the line above that has a date/timestamp
Posted: 08 Sep 2017 07:15
Hello All,
I found this form by looking for a better way to parse logs and someone advised to use JREPL7.0. The issue here is I am new and a bit confused to advance regex. What I need is a syntax to scan large log files and move log lines that don't have date/time at the beginning of the file to the logline above.
In my log files, log lines always start with entries like "2017-08-16T09:25:12.521-0400" however, when we hit exceptions, xml data, sql query results, it's printed under the log lines with no time stamp.
I am trying to create a JREPL command to take the data with no time stamps and add them on the lines with the above timestamp. The Goal here is to end up with a log that has only lines that start with the date/time stamps. This way, I can merge other logs and sort them by time.
End Result:
2017-04-24T04:26:58.728-0400 - VALUE {tomcat-device-http-1} none|none [{{0ecfe8a7}{Uri, - WARN Could not marshal entity java.lang.ArrayIndexOutOfBoundsException: -1 at com.sun..java:487) at com.sun:323) at com.sun.java:251)
2017-04-24T04:26:59.425-0400 VALUE {tomcat-device-http-1} none|none
2017-08-16T09:25:12.568-0400 - bla
Using Windows 10 machines to do this
I found this form by looking for a better way to parse logs and someone advised to use JREPL7.0. The issue here is I am new and a bit confused to advance regex. What I need is a syntax to scan large log files and move log lines that don't have date/time at the beginning of the file to the logline above.
In my log files, log lines always start with entries like "2017-08-16T09:25:12.521-0400" however, when we hit exceptions, xml data, sql query results, it's printed under the log lines with no time stamp.
I am trying to create a JREPL command to take the data with no time stamps and add them on the lines with the above timestamp. The Goal here is to end up with a log that has only lines that start with the date/time stamps. This way, I can merge other logs and sort them by time.
Code: Select all
2017-04-24T04:26:58.728-0400 - VALUE {tomcat-device-http-1} none|none
[{{0ecfe8a7}{Uri, - WARN Could not marshal entity
java.lang.ArrayIndexOutOfBoundsException: -1
at com.sun..java:487)
at com.sun:323)
at com.sun.java:251)
2017-04-24T04:26:59.425-0400 VALUE {tomcat-device-http-1} none|none
2017-08-16T09:25:12.568-0400 - bla
End Result:
2017-04-24T04:26:58.728-0400 - VALUE {tomcat-device-http-1} none|none [{{0ecfe8a7}{Uri, - WARN Could not marshal entity java.lang.ArrayIndexOutOfBoundsException: -1 at com.sun..java:487) at com.sun:323) at com.sun.java:251)
2017-04-24T04:26:59.425-0400 VALUE {tomcat-device-http-1} none|none
2017-08-16T09:25:12.568-0400 - bla
Using Windows 10 machines to do this