Hello, Below is the Input logs string I’m reading from log file.
2023-04-18 05:39:54 [main] INFO com.abc.crsbatch.controller.Controller - Jobs Selected to Run: FUNDING_TYPE_SOURCING Job
2023-04-18 03:52:25 [main] ERROR com.abc.crsbatch.controller.Controller - Exception occurred while Sourcing type Job : TYPE_SOURCING JOB FAILED
2023-04-18 03:52:25 [main] ERROR com.abc.crsbatch.controller.Controller - java.lang.NullPointerException
2023-04-18 03:52:25 [main] INFO com.abc.crsbatch.services.TypeService - Clearing data from Temp Table
2023-04-18 03:52:25 [main] INFO com.abc.crsbatch.dao.TypeDao - Cleared Data
2023-04-18 03:52:25 [main] INFO com.abc.crsbatch.controller.Controller - ended
Please help me to get below expected output with last 2 occurrences of Errors using regex expression
2023-04-18 03:52:25 [main] ERROR com.abc.crsbatch.controller.Controller - Exception occurred while Sourcing type Job : TYPE_SOURCING JOB FAILED
2023-04-18 03:52:25 [main] ERROR com.abc.crsbatch.controller.Controller - java.lang.NullPointerException
Parvathy
(PS Parvathy)
4
Hi @Ramesh_Kola1
Assign activity -->
Input= "2023-04-18 05:39:54 [main] INFO com.abc.crsbatch.controller.Controller - Jobs Selected to Run: FUNDING_TYPE_SOURCING Job
2023-04-18 03:52:25 [main] ERROR com.abc.crsbatch.controller.Controller - Exception occurred while Sourcing type Job : TYPE_SOURCING JOB FAILED
2023-04-18 03:52:25 [main] ERROR com.abc.crsbatch.controller.Controller - java.lang.NullPointerException
2023-04-18 03:52:25 [main] INFO com.abc.crsbatch.services.TypeService - Clearing data from Temp Table
2023-04-18 03:52:25 [main] INFO com.abc.crsbatch.dao.TypeDao - Cleared Data
2023-04-18 03:52:25 [main] INFO com.abc.crsbatch.controller.Controller - ended"
Assign activity -->
Output= System.Text.RegularExpression.Reges.Matches(Input,"(?<=\n\s*)\d+-\d+-\d+.*ERROR[\s\S].*")
DataType of Output: IEnumerable(System.Text.RegularExpression.Match)
Run for For Each loop for Output and print it using Message Box or Log Message
Hope it helps!!
Hi Shiva,
this won’t work in this case error line ends with Exception but if we have any other keywords and line have ERROR keyword we have pull that line.
and pulling all the line except first line but in my case it has to pull only lines with ERROR keyword
@Ramesh_Kola1
system.text.RegularExpressions.Regex.Match(inputstr,“\n[\s\S]+(?<=ERROR).*”).Value
Can you try this once ,It if not works can you please provide your exact output
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.