Following is Sample the data on which regex should be applied:
2019-05-27 10:49:18,418 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph - Filter -> Map (1/1) (824780055001546646d35df7a64cfe3c) switched from CANCELING to CANCELED.
2019-05-27 10:49:18,418 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph - Try to restart or fail the job (3064130e1dccead0b037f193d3699c3b) if no longer possible.
2019-05-27 10:49:18,418 ERROR org.apache.flink.runtime.executiongraph.ExecutionGraph - Job (3064130e1dccead0b037f193d3699c3b) switched from state FAILING to FAILED.
java.lang.IllegalArgumentException: json can not be null or empty
at com.jayway.jsonpath.internal.Utils.notEmpty(Utils.java:256)
at com.jayway.jsonpath.JsonPath.compile(JsonPath.java:424)
at com.mypkg.subpkg.ControlData$ConnectedStreams.validateJsonPath(ControlData.java:194)
at com.mypkg.subpkg.ControlData$ConnectedStreams.flatMap1(ControlData.java:178)
at com.mypkg.subpkg.ControlData$ConnectedStreams.flatMap1(ControlData.java:171)
at org.apache.flink.streaming.api.operators.co.CoStreamFlatMap.processElement1(CoStreamFlatMap.java:53)
at org.apache.flink.streaming.runtime.io.StreamTwoInputProcessor.processInput(StreamTwoInputProcessor.java:238)
at org.apache.flink.streaming.runtime.tasks.TwoInputStreamTask.run(TwoInputStreamTask.java:117)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:300)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:711)
at java.lang.Thread.run(Thread.java:748)
2019-05-27 10:49:18,418 ERROR org.apache.flink.runtime.executiongraph.ExecutionGraph - Could not restart the job (3064130e1dccead0b037f193d3699c3b) because the restart strategy prevented it.
java.lang.IllegalArgumentException: json can not be null or empty
at com.jayway.jsonpath.internal.Utils.notEmpty(Utils.java:256)
at com.jayway.jsonpath.JsonPath.compile(JsonPath.java:424)
at com.mypkg.subpkg.ControlData$ConnectedStreams.validateJsonPath(ControlData.java:194)
at com.mypkg.subpkg.ControlData$ConnectedStreams.flatMap1(ControlData.java:178)
at com.mypkg.subpkg.ControlData$ConnectedStreams.flatMap1(ControlData.java:171)
at org.apache.flink.streaming.api.operators.co.CoStreamFlatMap.processElement1(CoStreamFlatMap.java:53)
at org.apache.flink.streaming.runtime.io.StreamTwoInputProcessor.processInput(StreamTwoInputProcessor.java:238)
at org.apache.flink.streaming.runtime.tasks.TwoInputStreamTask.run(TwoInputStreamTask.java:117)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:300)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:711)
at java.lang.Thread.run(Thread.java:748)
2019-05-27 10:49:18,418 INFO org.apache.flink.runtime.checkpoint.CheckpointCoordinator - Stopping checkpoint coordinator for job 3064130e1dccead0b037f193d3699c3b.
2019-05-27 10:49:18,418 INFO org.apache.flink.runtime.checkpoint.StandaloneCompletedCheckpointStore - Shutting down
2019-05-27 10:49:18,419 INFO org.apache.flink.runtime.dispatcher.StandaloneDispatcher - Job 3064130e1dccead0b037f193d3699c3b reached globally terminal state FAILED.
Basically what I want to extract is time stamp and ERROR with message:
For an instance:
TimeStamp Error
2019-05-27 10:49:18,418 ERROR org.apache.flink.runtime.executiongraph.ExecutionGraph - Job (3064130e1dccead0b037f193d3699c3b) switched from state FAILING to FAILED.
java.lang.IllegalArgumentException: json can not be null or empty
at com.jayway.jsonpath.internal.Utils.notEmpty(Utils.java:256)
at com.jayway.jsonpath.JsonPath.compile(JsonPath.java:424)
at com.mypkg.subpkg.ControlData$ConnectedStreams.validateJsonPath(ControlData.java:194)
at com.mypkg.subpkg.ControlData$ConnectedStreams.flatMap1(ControlData.java:178)
at com.mypkg.subpkg.ControlData$ConnectedStreams.flatMap1(ControlData.java:171)
at org.apache.flink.streaming.api.operators.co.CoStreamFlatMap.processElement1(CoStreamFlatMap.java:53)
at org.apache.flink.streaming.runtime.io.StreamTwoInputProcessor.processInput(StreamTwoInputProcessor.java:238)
at org.apache.flink.streaming.runtime.tasks.TwoInputStreamTask.run(TwoInputStreamTask.java:117)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:300)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:711)
at java.lang.Thread.run(Thread.java:748)
Here Error message is split into multiple lines to for that I have written java pattern like below:
((?m)\\d{4}-[01]\\d-[0-3]\\d\\s[0-2]\\d((:[0-5]\\d)?){2}[\\s\\S]*ERROR[\\s\\S]*[ ]*at [\\s\\S]*)
But it returns me all the content of the file.
What should I do to make it work so that it will give me multi-line error message too.