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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...