Create reports that display summary statistics
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 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
Here's a slightly more sophisticated example of the
stats command, in 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
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.
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 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.
In addition, Splunk uses that set of commands to generate a chart displaying the average kbps for all events with a sourcetype of
access_combined, broken out by host.
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: 5.0, 5.0.1, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 5.0.9, 5.0.10, 5.0.11, 5.0.12, 5.0.13, 5.0.14, 5.0.15, 5.0.16, 5.0.17, 5.0.18