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!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...