Splunk Search

How can I use the eval function mvzip with 8 attributes?

leonheart78
Explorer

Trying to achieve the below:
eval x=mvzip(Title,Serial,beginTime,language,a1,a2,b1,b2)

How can I achieve this?
Thank you.

Tags (3)
0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

Your base search | eval x=mvzip(Title,mvzip(Serial,mvzip(beginTime,mvzip(language,mvzip(a1,mvzip(a2,mvzip(b1,b2)))))))

View solution in original post

gcato
Contributor

Hi Leonheart78,

You can find some good answers here.

http://answers.splunk.com/answers/123887/how-to-expand-multiple-multivalue-fields.html
http://answers.splunk.com/answers/130571/three-are-more-multiple-value-for-mvzip.html

Potentially, a foreach loop could be used. For example

| noop | stats count as a | eval a=mvrange(1,3) | eval b=mvrange(3,6) | eval c=mvrange(6,8) | foreach a b c [ mvexpand <<FIELD>> ] | eval x="" 
 | foreach a b c [ eval x=mvzip(x, '<<FIELD>>') ] | rex mode=sed field=x "s/^,//"

    a   b   c   x
    1   3   6   1,3,6
    1   3   7   1,3,7
    1   4   6   1,4,6
    ...

The rex command strips the initial null x field value out again. Hope that helps.

jet1276
Path Finder

This works like a charm. Thanks.

0 Karma

somesoni2
Revered Legend

Try like this

Your base search | eval x=mvzip(Title,mvzip(Serial,mvzip(beginTime,mvzip(language,mvzip(a1,mvzip(a2,mvzip(b1,b2)))))))
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 ...