Splunk Search

Regex from EventCode 7035

MrWh1t3
Path Finder

I am trying to create a regex that will parse a portion of a sentence within a Windows Log event.

As an example, EventCode=7035 generates the following:

The Network Location Awareness (NLA) service was.....sent a start
The Network Connection service was....sent a stop
The HTTP service was....sent a start
The HTTP service was....sent a stop
etc...

What I would like to parse out is, just the information between "The" and "service" and also the words start or stop.

That way I can build a list of services there were started or stopped.

So far I have:

EventCode=7035 | dedup Message | rex field=Message "(?i)="The (.*?) service .*? (start|stop)"

It doesn't seem to be working like I want. I would like it to output into table format along with the ComputerName Extracted_Service_Name and whether or not it was started or stopped.

Thoughts on this?

Tags (2)
0 Karma
1 Solution

lguinn2
Legend

Try this:

EventCode=7035 
| dedup Message 
| rex field=Message "The (?<Extracted_Service_Name>.*?) service was .*? sent a (?<Action>start|stop)"
| table ComputerName Extracted_Service_Name Action

View solution in original post

0 Karma

lguinn2
Legend

Another concern I have - what if a service was started and stopped several times within your search time range? Because you are de-duping the Message, you would only see one start and one stop. Is this what you want? It would also be possible to count the number of starts/stops if you didn't dedup...

0 Karma

lguinn2
Legend

Try this:

EventCode=7035 
| dedup Message 
| rex field=Message "The (?<Extracted_Service_Name>.*?) service was .*? sent a (?<Action>start|stop)"
| table ComputerName Extracted_Service_Name Action
0 Karma

lguinn2
Legend

To get rid of the blanks,

EventCode=7035
| dedup Message
| rex field=Message "The (?<Extracted_Service_Name>.*?) service was .*? sent a (?<Action>start|stop)"
| where Extracted_Service_Name!=null()
| table ComputerName Extracted_Service_Name Action

But can you show an example of an event where it extracted blanks? I wonder if the regular expression could be better...

0 Karma

MrWh1t3
Path Finder

It picks up a few "blank" Extracted_Service_Name, but I think this will be, ok. I really appreciate it. I also see where I was going wrong. Thanks a lot!!!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...