Splunk Search

How do you transform table values to a column replaced by values?

mgutschelhofer
Explorer

Hi Folks,

I'm still new to Splunk queries. I'm struggling with the following (simple) table transformation:

  • All values from a column should be added as a new column
  • Values for this new column should be taken from a specific column

Best to show as example. Here is my input:

status   stage count
--------------------
FAIL     dev   12
OK       dev   14
FAIL     prod  13
OK       prod  34
FAIL     prev  78
OK       prev  23

Which I would like to transform to this:

stage   OK   FAIL
-----------------
dev     14   12
prev    23   78
prod    34   13

Help appreciated & Thanks!

0 Karma
1 Solution

vnravikumar
Champion

Hi @mgutschelhofer

Try like

yoursearch |xyseries stage status count |stats values(OK) as OK values(FAIL) as FAIL by stage

View solution in original post

0 Karma

vnravikumar
Champion

Hi @mgutschelhofer

Try like

yoursearch |xyseries stage status count |stats values(OK) as OK values(FAIL) as FAIL by stage
0 Karma

mgutschelhofer
Explorer

Excellent, this did the job!
Many Thanks, Martin

0 Karma

vnravikumar
Champion

Welcome 🙂

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...