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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...