Splunk Search

Column to row conversion

gauravmishra15
Path Finder

Hi friends

I am facing an issue where I have to consolidate and convert the data from Column to rows. The sample data looks like this -

Datetime result duration Dash1 Dash2 Dash3
05-09-2017 20:45:11 SUCCESS 11.07 3.91 3.33 3.34
05-09-2017 20:44:01 SUCCESS 20.57 7.94 6.62 5.32
05-09-2017 20:43:06 SUCCESS 19.98 7.89 6.40 5.14
05-09-2017 20:42:05 SUCCESS 21.29 8.13 6.90 5.82
05-09-2017 20:41:18 SUCCESS 16.38 5.98 5.69 4.18

I have to change data in this format

Datetime result Name ResponseTime

05-09-2017 20:45:11 SUCCESS duration 11.07

05-09-2017 20:45:11 SUCCESS Dash1 3.91

05-09-2017 20:45:11 SUCCESS Dash2 3.33

05-09-2017 20:45:11 SUCCESS Dash3 3.34

05-09-2017 20:44:01 SUCCESS duration 20.57
05-09-2017 20:44:01 SUCCESS Dash1 7.94

05-09-2017 20:44:01 SUCCESS Dash2 6.62

05-09-2017 20:44:01 SUCCESS Dash3 5.32

Is there a way we can achieve this in SPLUNK ?

niketn
Legend

@gauravmishra15, Unless data in table 1 is your raw data, can you share your existing query which gets you table 1 with Datetime result duration Dash1 Dash2 Dash3? It would be better if we plotted required table 2 directly from your raw events rather than creating table 1 to table 2.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

HiroshiSatoh
Champion

Try this!

(your search)
| eval wk="duration="+duration+","+"Dash1="+Dash1+","+"Dash2="+Dash2+","+"Dash3="+Dash3
| makemv delim="," wk| mvexpand wk
| rex field=wk "^(?<Name>.*)=(?<ResponseTime>.*)$"
| table Datetime,result,Name,ResponseTime
0 Karma
Get Updates on the Splunk Community!

New Release | Splunk Enterprise 9.3

Admins and Analyst can benefit from:  Seamlessly route data to your local file system to save on storage ...

2024 Splunk Career Impact Survey | Earn a $20 gift card for participating!

Hear ye, hear ye! The time has come again for Splunk's annual Career Impact Survey!  We need your help by ...

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...