Splunk Search

How to use timechart to get two different timechart averages, then get a sum of those two values in each time span?

zqmirza
New Member

I am using the search below to get two different averages from two different indexes:

index=a| bucket _time span=4h | stats avg(session_count) as X by _time
| append [search index=b| bucket _time span=4h | stats avg(session_count) as Y by _time] 

Now I want a time chart to sum X & Y in each of the 4 hour time frames
Can you please see the search I wrote and suggest how to get this result?

0 Karma
1 Solution

renjith_nair
Legend

Try this

(index=a OR index=b)|timechart span=4h usenull=f avg(session_count) by index|eval sum=a+b
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

Try this

(index=a OR index=b)|timechart span=4h usenull=f avg(session_count) by index|eval sum=a+b
---
What goes around comes around. If it helps, hit it with Karma 🙂

zqmirza
New Member

yes, it's working just need to use the fields - a, b to only show the sum. Great! Thanks.

0 Karma
Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

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