Splunk Search

Overlay an average line on a bar graph of counts

ellenbytech
Explorer

I have a search index=safes TransactionCode=DOPN OR TransactionCode=DCLO Details="Door A Opened" OR Details="Door A Closed"
| transaction open_close startswith=DOPN endswith=DCLO maxevents=2 | search eventcount=2
| stats count(duration) as Events by Location
.

This gives me the number of relevant events by Location for the month I'm looking at. I want to display an average value line across the bar graph. However changing the last command to |stats count(duration) as Events, avg(Events) as Event_avg by Location doesn't create a value for Event avg and doesn't let me select Event avg as an overlay on the graph. I've seen many questions similar to this but the answers all seemed to refer to splitting up events by _time rather than some other field such as Location.

0 Karma
1 Solution

DalJeanis
Legend

Add at the end...

 | eventstats avg(Events) as Event_avg

That will put the same overall average on every event.

Haven't done overlays myself, so that only gets you halfway there, but the data will be available anyway.

View solution in original post

DalJeanis
Legend

Add at the end...

 | eventstats avg(Events) as Event_avg

That will put the same overall average on every event.

Haven't done overlays myself, so that only gets you halfway there, but the data will be available anyway.

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