Splunk Search

Need to write both rex and regex

vishwanadhan_mu
Explorer

"C:\Users\TestUser\AppData\Local\Microsoft\Teams\Update.exe" --processStart "Teams.exe" --process-start-args "--system-initiated"

Could someone help me writing regex and rex to extract field(which is a process) name after --processStart .

Next I'll filter out filed name which I don't want match.

Thanks in Advance

Tags (2)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Try this

| makeresults 
| eval temp="\"C:\Users\TestUser\AppData\Local\Microsoft\Teams\Update.exe\" --processStart \"Teams.exe\" --process-start-args \"--system-initiated\"" 
| rex field=temp "--processStart\s\"(?P<processname>[^--]+)\""

View solution in original post

jawaharas
Motivator

Try this.

Field extracted using space as delimiter.

| makeresults 
 | eval input="\"C:\Users\TestUser\AppData\Local\Microsoft\Teams\Update.exe\" --processStart \"Teams.exe\" --process-start-args \"--system-initiated\"" 
 | rex field=input "^(?:[^\s]* ){2}\"(?<process>[^ ]+)\""

vishwanadhan_mu
Explorer

This too worked for me. Thanks a lot.

0 Karma

vnravikumar
Champion

Hi

Try this

| makeresults 
| eval temp="\"C:\Users\TestUser\AppData\Local\Microsoft\Teams\Update.exe\" --processStart \"Teams.exe\" --process-start-args \"--system-initiated\"" 
| rex field=temp "--processStart\s\"(?P<processname>[^--]+)\""

vishwanadhan_mu
Explorer

This worked. Thanks a lot

0 Karma

vishwanadhan_mu
Explorer

If you don't mind can you explain me [^--]+)\"" this part

0 Karma

vnravikumar
Champion

I mentioned to extract from processStart to before --

Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

New This Month - Observability Updates Give Extended Visibility and Improve User ...

This month is a collection of special news! From Magic Quadrant updates to AppDynamics integrations to ...

Intro to Splunk Synthetic Monitoring

In our last post, we mentioned that the 3 key pieces of observability – metrics, logs, and traces – provide ...