Splunk Search

How can I add new columns and name them by result or subsearch?

millie
Engager

Hi!
I would like to draw a chart with stacked bars , but I don't know how to add columns depend on result. for example, I first search and get the result as:

fieldA fieldB
A 1
B 2
C 3
D 4

But for drawing the chart, I need a result table like this, fields named by the result I got :

fieldA A B C D
dummy 1 2 3 4

The result might not be ABCD only. How could I do something like this? Thanks

Tags (2)
1 Solution

millie
Engager

Problem has been solved now, I've found a search command called "xyseries". I search as:

search ... | xyseries fieldA fieldB fieldB | addcoltotals labelfield=fieldA label="dummy" | where fieldA="dummy"

View solution in original post

0 Karma

millie
Engager

Problem has been solved now, I've found a search command called "xyseries". I search as:

search ... | xyseries fieldA fieldB fieldB | addcoltotals labelfield=fieldA label="dummy" | where fieldA="dummy"

0 Karma

ppablo
Retired

Hi @millie be sure to accept your answer so other users know it's correct when searching for similar issues 🙂

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

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 ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...