icon/x Created with Sketch.

Splunk Cookie Policy

We use our own and third-party cookies to provide you with a great online experience. We also use these cookies to improve our products and services, support our marketing campaigns, and advertise to you on our website and other websites. Some cookies may continue to collect information after you have left our website. Learn more (including how to update your settings) here.
Accept Cookie Policy

Accept License Agreements

This app is provided by a third party and your right to use the app is in accordance with the license provided by that third-party licensor. Splunk is not responsible for any third-party apps and does not provide any warranty or support. If you have any questions, complaints or claims with respect to this app, please contact the licensor directly.

Thank You

Downloading clusterstats
SHA256 checksum (clusterstats_10.tgz) f884a8b1fbfc4f7e1d33af53b3e76d0cc7fdac27af4af7e87cae4586cf70fd1d
To install your download
For instructions specific to your download, click the Details tab after closing this window.

Flag As Inappropriate


clusterstats is an external python search command which gives statistics about clusters or groups of slow transactions which take place in a maximum span of seconds.

clusterstats v1.0 by Sean Foley, tested on Splunk 6.1.2

clusterstats is an external python search command packaged as an add-on for

I wrote clusterstats to give stats about clusters of anomalous (slow)
transactions. The search I was working with used transaction to tie related
events into a transaction and add the duration field. I then piped the results
into a command to filter out the normal transactions and leave the slow ones:

| search duration > 3

The command expects to be passed a maxspansecs=X argument and it expects to be
piped events which contain _time and duration fields, and it expects the results
to be in reverse order since it needs to process in time order to calculate the
start of a cluster, the end of a cluster, the number of transactions in the
cluster, the max and mean duration for the cluster. Keep in mind that the max is
probably accurate but the mean is only averaging the duration from the filtered events so it is the mean duration for the cluster of events > than 3 seconds if the above filtering search is used.

The command returns a new set of events to splunk web which represent timings
and statistics from each cluster identified in the original set of events as
determined by the maxspansecs window. The following fields are returned:

_time : the start time of the cluster

cluster_end_time : the calculated end time of the event based on the latest
transaction end time (transaction start + duration).
cluster_max_duration : the highest duration value from cluster transactions

cluster_mean_duration : the mean of the duration values for the cluster

As a starting point I use the following to nicely format the epoch times and float values after my base search, the transaction command, and the search duration filter above:

| clusterstats maxspansecs=30
| convert timeformat="%m/%d/%Y %H:%M:%S" ctime(cluster_end_time)
as cluster_end_time
| convert timeformat="%m/%d/%Y %H:%M:%S" ctime(cluster_last_txn_start)
as cluster_last_txn_start
| table _time cluster_end_time cluster_txn_count cluster_max_duration
| eval cluster_max_duration=round(cluster_max_duration,2)
| eval cluster_mean_duration=round(cluster_mean_duration,2)
| rename _time as cluster_start_time
|convert timeformat="%m/%d/%Y %H:%M:%S" ctime(cluster_start_time)
as cluster_start_time

This should get you going.

Release Notes

Version 1.0
Sept. 18, 2014

Initial release.


Subscribe Share

AppInspect Tooling

Splunk AppInspect evaluates Splunk apps against a set of Splunk-defined criteria to assess the validity and security of an app package and components.

Are you a developer?

As a Splunkbase app developer, you will have access to all Splunk development resources and receive a 50GB license to build an app that will help solve use cases for customers all over the world. Splunkbase has 1000+ apps and add-ons from Splunk, our partners and our community. Find an app or add-on for most any data source and user need, or simply create your own with help from our developer portal.

Follow Us:
© 2005-2019 Splunk Inc. All rights reserved.
Splunk®, Splunk>®, Listen to Your Data®, The Engine for Machine Data®, Hunk®, Splunk Cloud™, Splunk Light™, SPL™ and Splunk MINT™ are trademarks and registered trademarks of Splunk Inc. in the United States and other countries. All other brand names, product names, or trademarks belong to their respective owners.