Splunk Search

How to extract repeated field values in same event?

rajs115
Path Finder
Hi Guys, I am new to splunk. I need to run a query to extract the system name value which is repeated twice in the same log event. Logs in one event are: user: user1 system: system1 user:user2 system: system2 output should look like below: output1 output2 system1 system2 cheers.
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=2 "system:\s(?<system>[\S]+)"
| eval system1=mvindex(system,0)
| eval system2=mvindex(system,1)

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=2 "system:\s(?<system>[\S]+)"
| eval system1=mvindex(system,0)
| eval system2=mvindex(system,1)

rajs115
Path Finder

@ITWhisperer ,

 

Logs in one event are:

user: user1

system: system1

 

user:user2

system: system2

 

output should look like below:

output1      output2

system1     system2

 

I tried as you suggested. Not returning any values.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Can you share the raw events in a code block </>

0 Karma

rajs115
Path Finder

@ITWhisperer ,

  Its working now. Made a slight change from your command. Not sure it its appropriate or not. is there any way we can compare these two values  or same or not (if system1=system2) 

 

| rex max_match=2 "system:\s(?<system>[\S]+)"
| eval system1=mvindex(system,-1)
| eval system2=mvindex(system,0)

 

0 Karma

rajs115
Path Finder
Logs in one event are: user: user1 system: system1 user:user2 system: system2 output should look like below: output1 output2 system1 system2
0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...