Splunk Search

how to add column averages to a timechart

michaeljlancast
Explorer

I have a timechart that shows me the daily throughput for a log source per indexer. I'm trying to find a way to add the average at the bottom for each column of the chart to show me the daily average per indexer. There is a command called "addcoltotal", but I'm looking for the average.

index=_internal source="*metrics.log" group=per_source_thruput series=network earliest=-30d | eval dailyGB=(kb/1024000) | timechart span=1d sum(dailyGB) by host

        _time                   indexer1          index2           indexer3
    1   3/7/12 12:00:00.000 AM  7.86325036907982  8.8324329432009  3.432423543254   
    2   3/8/12 12:00:00.000 AM  55.2752835159227  0.1303261899898  2.134345324324
    3   3/9/12 12:00:00.000 AM  53.2091017865928  4.8808330507275  5.6209532661776
    4   3/10/12 12:00:00.000 AM 17.6108422803661  5.2928352422775  3.5238746919151
    Average:                    #                 #                #
Tags (1)

Stephen_Sorkin
Splunk Employee
Splunk Employee

You can use appendpipe to append an average:

index=_internal source="*metrics.log" group=per_source_thruput series=network earliest=-30d
| eval dailyGB=(kb/1024000)
| timechart span=1d sum(dailyGB) by host
| appendpipe [stats avg(*) as *]

Stephen_Sorkin
Splunk Employee
Splunk Employee

In general, you can use plain old | append [...] and put the whole search, index=_internal source="*metrics.log" group=per_source_thruput series=network earliest=-30d
| eval dailyGB=(kb/1024000)
| timechart span=1d sum(dailyGB) by host
| stats avg(*) as *
, in the subsearch.

0 Karma

michaeljlancast
Explorer

appendpipe is only available in 4.3. Any solution for 4.1.8?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...