Splunk Search

Regex- Help with extracting field

Dayalss
Engager

Can someone please help me in extracting the field Specific_DL_Testing from the below sample log.

instance of the "\Specific_DL_Testing" task.

The output should be Specific_DL_Testing

Labels (1)
0 Karma

Dayalss
Engager

I have used the above expression but its not extracting the field.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Here is a runanywhere example of it working

| makeresults 
| eval _raw="instance of the \"\\Specific_DL_Testing\" task." 
| rex "instance of the \"\\\(?<task>[^\"]+)\" task."

If it is not working for you, please provide example events and the SPL you are using (preferably in code blocks </> like the example above to prevent information being lost due to formatting

0 Karma

Dayalss
Engager

Task Scheduler terminated "{8878FDRGSGS-8cde-1234-123456789}" instance of the "\Specific_DL_Testing" task.

 

Please try on this event

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults 
| eval _raw="Task Scheduler terminated \"{8878FDRGSGS-8cde-1234-123456789}\" instance of the \"\\Specific_DL_Testing\" task." 
| rex "instance of the \"\\\(?<task>[^\"]+)\" task."
0 Karma

Dayalss
Engager

 I see you are checking for "\\Specific_DL_Testing\"

 Can you try for "\Specific_DL_Testing\" 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I am not checking for "\\Specific_DL_Testing\" - this is part of the eval command to create the sample _raw field in line with what you say is your event

ITWhisperer_0-1679565726287.png

As you can see from the _raw field in the screenshot, the event matches what you said you event was.

 

0 Karma

Dayalss
Engager

Getting error :- Error in 'rex' command: Encountered the following error while compiling the regex '\instance of the "\(?<task>[^"]+)" task.': Regex: unrecognized character follows \.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I missed a backslash

| rex "instance of the \"\\\(?<task>[^\"]+)\" task."
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "instance of the \"\\(?<task>[^\"]+)\" task."
0 Karma
Get Updates on the Splunk Community!

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...

Join Us at the Builder Bar at .conf24 – Empowering Innovation and Collaboration

What is the Builder Bar? The Builder Bar is more than just a place; it's a hub of creativity, collaboration, ...

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...