Splunk Search

Extract multiple values when field is in the same log twice

bcarr12
Path Finder

Hi all,

I am working with a log that can sometimes have the same field in one log entry more than one time, but with multiple values.

Examples:

Ex 1:
100=A

Ex 2:
100=A 100=B 100=C

Ex 3:
100=D

Ex 4:
100=A 100=D

As I've seen discussed before, Splunk only seems to pull the first value out whenever the field is repeated. What would be the best way to tell Splunk at searchtime that I want to pull all "100" values from the log and not just the first one?

Tags (1)
0 Karma
1 Solution

DalJeanis
SplunkTrust
SplunkTrust

Try this -

| rex field=_raw "100=(?<my100>\w+)" max_match=0

View solution in original post

cpetterborg
SplunkTrust
SplunkTrust

If you just want to get the values in the same field as a multivalve field, then this type search should work:

| makeresults | eval _raw="100=A 100=B 100=C" | rex field=_raw max_match=10 "100=(?P<field100>\w+)"

bcarr12
Path Finder

Thanks for the suggestion!

0 Karma

DalJeanis
SplunkTrust
SplunkTrust

Try this -

| rex field=_raw "100=(?<my100>\w+)" max_match=0

bcarr12
Path Finder

Thanks, this worked perfectly!

xlash911
Explorer

Saved my life, thanks!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...