Splunk Search

How to reformat the table output?

zacksoft
Contributor
| base query with some eval commands 
| table a_snake, a_cat, a_dog, b_snake, b_cat, b_dog, c_snake, c_cat, c_dog

However, I want the values to be arranged like this with the column header as SNAKE, CAT, DOG

SNAKE    CAT    DOG
a_snake  a_cat  a_dog
b_snake  b_cat  b_dog
c_snake   c_cat  c_dog
0 Karma
1 Solution

kmaron
Motivator

Using what you provided this is what I have

| makeresults 
 | eval animal = "a_cat a_snake a_dog b_cat b_snake b_dog c_cat c_snake c_dog" 
 | makemv animal
 | mvexpand animal
 | rex field=animal "^(?<Letter>.*?)_(?<Type>.*?)$"
 | eval Type = upper(Type)
 | chart values(animal) over Letter by Type
 | fields - Letter

View solution in original post

kmaron
Motivator

Using what you provided this is what I have

| makeresults 
 | eval animal = "a_cat a_snake a_dog b_cat b_snake b_dog c_cat c_snake c_dog" 
 | makemv animal
 | mvexpand animal
 | rex field=animal "^(?<Letter>.*?)_(?<Type>.*?)$"
 | eval Type = upper(Type)
 | chart values(animal) over Letter by Type
 | fields - Letter

Richfez
SplunkTrust
SplunkTrust

What do your events actually look like?

And what output does your existing table command show?

(It might actually be useful to know what those eval commands are, but they may not be important)

0 Karma

zacksoft
Contributor

The existing output is,
There is One row and Nine columns
And the column headers are left to right specified as a_snake a_cat a_dog b_snake b_cat b_dog .....

0 Karma

kmaron
Motivator

are a_snake a_cat, etc field names or values? I feel like you may be generalizing too much and something is getting lost. Your table command treats them like fields but then your example table has them like values.

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!

Introducing ITSI 5.0: Unified Visibility and Actionable Insights

Introducing ITSI 5.0: Unified Visibility and Actionable Insights Tuesday, July 21, 2026  |  10:00AM PT / ...

Inside Splunk Agent Observability: Understanding Agent Behavior, Tokens & Costs

Inside Splunk Agent Observability:Understanding Agent Behavior, Tokens & Costs Thursday, August 06, ...

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...