Splunk Search

How to create a stacked column chart with count(_time) split by index (_internal, main) for each host?

gsawyer1
Engager

I don't understand why this should be so difficult....okay, here is my search:

host=* index=_internal OR index=main | stats count(_time) by host index

This does generate the data I want - for each host, there is a count of number of events in each of the two indexes. I want to split the bar graph by index, and display the count(_time) in each index for each host.

So host x should display one bar, split as two colors - one for each index - and each color indicating the number of events in that index. And all of the hosts should comprise the x-axis. So that way I can compare the ratio of fill of each index, for each host.
I can't find any examples of stacked charts online that help me much. Liked I said, seems like this should be easy....

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

It is easy if you use chart instead stats:

index=_internal OR index=main | chart count over host by index

The key difference is that this turns one set of field values into columns instead of rows.

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