Splunk Search

How to break multiple values into a new row ?

rsokolova
Path Finder

Thanks in advance,

We are having a hard time trying to split free and used space by partition, hope you can help.

alt text

alt text

1 Solution

harsmarvania57
Ultra Champion

Try something like this, first 2 lines are used to generate sample data only.

| makeresults
| eval _raw="{\"disk\": [{\"capacity\": \"12874416128\", \"diskPath\": \"/\", \"freeSpace\": \"12790087680\"}, {\"capacity\": \"7505707008\", \"diskPath\": \"/usr\", \"freeSpace\": \"3691720704\"}, {\"capacity\": \"1063256064\", \"diskPath\": \"/boot\", \"freeSpace\": \"825552896\"}, {\"capacity\": \"42392092672\", \"diskPath\": \"/logs\", \"freeSpace\": \"41320570880\"}, {\"capacity\": \"21250441216\", \"diskPath\": \"/shBC\", \"freeSpace\": \"2040201216\"}, {\"capacity\": \"7505707008\", \"diskPath\": \"/home\", \"freeSpace\": \"7430582272\"}, {\"capacity\": \"4284481536\", \"diskPath\": \"/tmp\", \"freeSpace\": \"4196638720\"}, {\"capacity\": \"10622074880\", \"diskPath\": \"/logarch\", \"freeSpace\": \"10588340224\"}, {\"capacity\": \"63319834624\", \"diskPath\": \"/apps\", \"freeSpace\": \"31894880256\"}, {\"capacity\": \"7505707008\", \"diskPath\": \"/var\", \"freeSpace\": \"5256704000\"}, {\"capacity\": \"7505707008\", \"diskPath\": \"/var/tmp\", \"freeSpace\": \"5256704000\"}]}"
| spath
| rename disk{}.capacity AS capacity, disk{}.diskPath AS path, disk{}.freeSpace AS space
| eval cap_path=mvzip(capacity,path)
| eval cap_path_space=mvzip(cap_path,space)
| mvexpand cap_path_space
| makemv delim="," cap_path_space
| eval capacity=mvindex(cap_path_space,0), path=mvindex(cap_path_space,1), space=mvindex(cap_path_space,2)
| fields - cap_path,cap_path_space

View solution in original post

rsokolova
Path Finder

This is a piece of the raw data without being organized.

disk": [{"capacity": "12874416128", "diskPath": "/", "freeSpace": "12790087680"}, {"capacity": "7505707008", "diskPath": "/usr", "freeSpace": "3691720704"}, {"capacity": "1063256064", "diskPath": "/boot", "freeSpace": "825552896"}, {"capacity": "42392092672", "diskPath": "/logs", "freeSpace": "41320570880"}, {"capacity": "21250441216", "diskPath": "/shBC", "freeSpace": "2040201216"}, {"capacity": "7505707008", "diskPath": "/home", "freeSpace": "7430582272"}, {"capacity": "4284481536", "diskPath": "/tmp", "freeSpace": "4196638720"}, {"capacity": "10622074880", "diskPath": "/logarch", "freeSpace": "10588340224"}, {"capacity": "63319834624", "diskPath": "/apps", "freeSpace": "31894880256"}, {"capacity": "7505707008", "diskPath": "/var", "freeSpace": "5256704000"}, {"capacity": "7505707008", "diskPath": "/var/tmp", "freeSpace": "5256704000"}],

0 Karma
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!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...