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
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...