Splunk Search

How to extract and separate 2 fields from my sample data?

kestasm
Path Finder

Hello,

I have this field in a WindowsEvent sourcetype in SPLUNK under the name "unparsed_message" and it contains some additional info and the info of my interest:

C:\Windows\System32\conhost.exe
C:\Windows\System32\cscript.exe
C:\Windows\System32\cmd.exe
C:\Windows\System32\dllhost.exe
C:\Program Files\LogSecUF\bin\splunkd.exe

So these entries are taken from 5 separate events. What I would need is to extract to separate fields from the lines above “process_path” and “process”. So the “process_path” would indicate the path where the process starts (e.g. C:\Windows\System32\) and the “process” field would indicate the process itself (e.g. cscript.exe).

Any suggestions?

Thanks,
Kestutis

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Rex can do the job.

... | rex field=unparsed_message "(?P<process_path>.*)\\(?P<process>.*)$" | ...
---
If this reply helps you, Karma would be appreciated.
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...