Splunk Search

How to count field values from two indexes and plot this on a graph?

tp92222
Explorer

I have 2 indexes: index=report and index=fixed

Both have the same field ticket. When a ticket is reported, it goes in both indexes, but when that ticket is resolved, it just gets removed from fixed index.

Now I wanted to compare how many tickets where there before January and how many are still remaining and plot them on a graph.

Example

index=report contains:
ticket
1
2
3
4
5

index=fixed contains:
ticket
1
4
5

It should give output as:

total count=5
remain=3

and plot this on a graph.

0 Karma

woodcock
Esteemed Legend

Try this base search:

index=report OR index=fixed | stats dc(index) AS Indices values(*) AS * by index

From there you can add any where indices ... clause that you like followed by another stats (or eventstats) clause to wrap it up.

0 Karma

fdi01
Motivator

try like :

 (index=report) OR(index=fixed) |stats count as total_count by  index
0 Karma

chimell
Motivator

Hi
try this

index=report |stats count(ticket) as total_count |appendcols[search index=fixed |stats count(ticket) as remain]

in visualisation tab choose for example Bar chart

0 Karma

gyslainlatsa
Motivator

hi tp92222,

i don't understand very well your problem, explain your problem in a simple way and tell us exactly what you want.

cordially

0 Karma
Get Updates on the Splunk Community!

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

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