Splunk Search

Help extracting fields from raw event

hippe21
Explorer

Here's what my raw event looks like:

58daf92d66c83d000e469dfd.txt unsupported file format 

I'd like to extract the following below during a search, to pull these fields:

  • task = 58daf92d66c83d000e469dfd
  • fileExt = .txt
  • errorReason = unsupported file format

How can I accomplish this using Rex?

Tags (3)
0 Karma
1 Solution

gjanders
SplunkTrust
SplunkTrust

Maybe something like:

| rex "(?P<task>^[^\.]+)(?P<fileExt>\S+\s(?P<errorReason>.*)"

I'm unsure if that first part should be [^.] or [^.]

The built in regular expression creator could help here or sites like https://regex101.com/

View solution in original post

0 Karma

gjanders
SplunkTrust
SplunkTrust

Maybe something like:

| rex "(?P<task>^[^\.]+)(?P<fileExt>\S+\s(?P<errorReason>.*)"

I'm unsure if that first part should be [^.] or [^.]

The built in regular expression creator could help here or sites like https://regex101.com/

0 Karma

hippe21
Explorer

This is exactly what I needed, thank you!

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...