Splunk Enterprise

I am trying to create a multivalue where I should split the data during the pipe symbol.

gemrose
Explorer

For example if my data is

platform = "operational", task="draft||draft-published",jobstart="2021-06-27T15:46:08.34666||2021-06-27T18:46:08.70000, jobend="2021-06-28T12:86:08.37836||2021-06-28T18:46:08.70990"

I need in the below format. I tried makemv delim="||" task but this happens for only one field. Is there any other option available ?

platformtaskjobstartjobend
operationaldraft2021-06-27T15:46:08.346662021-06-28T12:86:08.37836
operationaldraft-published2021-06-27T18:46:08.700002021-06-28T18:46:08.70990
Labels (1)
0 Karma
1 Solution

danielcj
Communicator

Hello,

Please try the following (The first two lines are just to mock your data as an example):

 

| makeresults 
| eval platform = "operational", task="draft||draft-published",jobstart="2021-06-27T15:46:08.34666||2021-06-27T18:46:08.70000", jobend="2021-06-28T12:86:08.37836||2021-06-28T18:46:08.70990" 
| eval jobstart = split(jobstart, "||"), task = split(task,"||"), jobend = split(jobend,"||") 
| eval multivalue = mvzip(mvzip(task, jobstart), jobend) 
| mvexpand multivalue 
| makemv multivalue delim="," 
| eval task = mvindex(multivalue, 0), jobstart = mvindex(multivalue, 1), jobend = mvindex(multivalue, -1) 
| table platform, task, jobstart, jobend

View solution in original post

gemrose
Explorer

Thank you @danielcj. your solution helped me a lot

 

0 Karma

danielcj
Communicator

Hello,

Please try the following (The first two lines are just to mock your data as an example):

 

| makeresults 
| eval platform = "operational", task="draft||draft-published",jobstart="2021-06-27T15:46:08.34666||2021-06-27T18:46:08.70000", jobend="2021-06-28T12:86:08.37836||2021-06-28T18:46:08.70990" 
| eval jobstart = split(jobstart, "||"), task = split(task,"||"), jobend = split(jobend,"||") 
| eval multivalue = mvzip(mvzip(task, jobstart), jobend) 
| mvexpand multivalue 
| makemv multivalue delim="," 
| eval task = mvindex(multivalue, 0), jobstart = mvindex(multivalue, 1), jobend = mvindex(multivalue, -1) 
| table platform, task, jobstart, jobend
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...