Create reports that display summary statistics
The stats and eventstats commands
eventstats command works in exactly the same manner as the
stats command, except that the aggregation results of the command are added inline to each event, and only the aggregations that are pertinent to each event.
Using split-by clauses
To fully utilize the
stats command, you need to include a "split by" clause. For example, the following report won't provide much information:
sourcetype=access_combined | stats avg(kbps)
It gives you the average of
kbps for all events with a sourcetype of
access_combined--a single value. The resulting column chart contains only one column.
But if you break out the report with a split by field, Splunk software generates a report that breaks down the statistics by that field. The following report generates a column chart that sorts through the
access_combined logs to get the average thruput (kbps), broken out by host:
sourcetype=access_combined | stats avg(kbps) by host
Example 1: Create a report that shows you the CPU utilization of Splunk processes, sorted in descending order:
index=_internal "group=pipeline" | stats sum(cpu_seconds) by processor | sort sum(cpu_seconds) desc
Example 2: Create a report to display the average kbps for all events with a sourcetype of
access_combined, broken out by host.
You specify the field name for the
eventstats results by adding the
as argument. So the first example above could be restated with "avgkbps" being the name of the new field that contains the results of the
eventstats avg(kbps) operation:
sourcetype=access_combined | eventstats avg(kbps) as avgkbps by host
When you run this set of commands, Splunk software adds a new
avgkbps field to each
sourcetype=access_combined event that includes the
kbps field. The value of
avgkbps is the average kbps for that event.
Visualize field value highs and lows
Look for associations, statistical correlations, and differences in search results
This documentation applies to the following versions of Splunk® Enterprise: 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.2.4, 6.2.5, 6.2.6, 6.2.7, 6.2.8, 6.2.9, 6.2.10, 6.2.11, 6.2.12, 6.2.13, 6.3.0, 6.3.1, 6.3.2, 6.3.3, 6.3.4, 6.3.5, 6.3.6, 6.3.7, 6.3.8, 6.3.9, 6.3.10, 6.3.11, 6.3.12, 6.4.0, 6.4.1, 6.4.2, 6.4.3, 6.4.4, 6.4.5, 6.4.6, 6.4.7, 6.4.8, 6.4.9, 6.5.0, 6.5.1, 6.5.1612 (Splunk Cloud only), 6.5.2, 6.5.3, 6.5.4, 6.5.5, 6.5.6, 6.5.7, 6.6.0, 6.6.1, 6.6.2, 6.6.3, 6.6.4, 6.6.5, 7.0.0, 7.0.1