Splunk Search

How to extract Multivalue fields?

shrek
Engager

Lets just say I have multiple events like this:

names

John

Sam

Todd

favorite_colors

Blue

Yellow

Green

Each event might have a different number of field values but the ratio of names to favorite_colors is 1:1.

Is it possible to extract these into new events or display them separately in a table like this:

name favourite_color
John Blue
Sam Yellow
Todd Green

 

I have tried mvexpand but that only works for 1 multivalue field.

Labels (3)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

As you say, mvexpand works on one event, so there are a couple of ways to do it, here is one

| eval row=mvrange(0,mvcount(name))
| mvexpand row
| eval name=mvindex(name,row)
| eval favourite_colour=mvindex(favourite_colour,row)
| fields - row

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

As you say, mvexpand works on one event, so there are a couple of ways to do it, here is one

| eval row=mvrange(0,mvcount(name))
| mvexpand row
| eval name=mvindex(name,row)
| eval favourite_colour=mvindex(favourite_colour,row)
| fields - row

shrek
Engager

This was exactly what I was looking for, thanks.

0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

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

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...