Dashboards & Visualizations

From multi-values event to splitted single-value events?

PeterGian
Engager

Hello community!
For a project I'm working on, I would need to split a "multivalues single event" into "multiple single value events".

Let me try to represent it for clarity:

As is:

Event:
A B C null D
E F G
H I L

Desired:

Event1:
A B C null D
Event2:
A B E F G
Event3:
A B H I L

 Is it possible to achieve this? 

I played around with mvexpand and mvzip but I wasn't able to reach my goal.

Thanks in advance for your kind support

Labels (1)
0 Karma

PeterGian
Engager

Works like a charm! Thanks

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Please can you clarify the events you are actually dealing with, as the representation you have used is unclear.

For example, are there actually 5 fields in your event, the last 3 being multi-value fields, or are the last 3 actually 3 occurrences of 3 fields such that the first occurrence has no value for the second field of the 3, or does it actually contain the word "null"?

There are possibly other interpretations of your representation too.

0 Karma

PeterGian
Engager

Hello,

thanks for your interest.

In the event there are 5 fields and the last 3 are multi-value fields. You are right, the word "null" could be misleading in this context, it is just representing the word "null" so it could be changed with whatever value.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults
| fields - _time
| eval field1="A"
| eval field2="B"
| eval field3=split("CEH","")
| eval field4=split("null,F,I",",")
| eval field5=split("DGL","")
``` The lines above just set up data inline with your example ```
| eval combined=mvzip(field3,mvzip(field4,field5,"|"),"|")
| mvexpand combined
| eval field3=mvindex(split(combined,"|"),0)
| eval field4=mvindex(split(combined,"|"),1)
| eval field5=mvindex(split(combined,"|"),2)
| fields - combined
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...