Splunk Cloud

Search Reference

Download manual as PDF

Download topic as PDF



Replaces a field value with higher-level grouping, such as replacing filenames with directories.

Returns the maxcount events, by taking the incoming events and rolling up multiple sources into directories, by preferring directories that have many files but few events. The field with the path is PATHFIELD (e.g., source), and strings are broken up by a separator character. The default pathfield=source; sizefield=totalCount; maxcount=20; countfield=totalCount; sep="/" or "\\", depending on the operation system.


bucketdir pathfield=<field> sizefield=<field> [maxcount=<int>] [countfield=<field>] [sep=<char>]

Required arguments

Syntax: pathfield=<field>
Description: Specify a field name that has a path value.
Syntax: sizefield=<field>
Description: Specify a numeric field that defines the size of bucket.

Optional arguments

Syntax: countfield=<field>
Description: Specify a numeric field that describes the count of events.
Syntax: maxcount=<int>
Description: Specify the total number of events to bucket.
Syntax: <char>
Description: The separating character. Specify either a forward slash "/" or double back slashes "\\", depending on the operating system.


The bucketdir command is a streaming command. See Command types.


Example 1:

Return 10 best sources and directories.

... | top source | bucketdir pathfield=source sizefield=count maxcount=10

See also

cluster, dedup

Last modified on 18 July, 2020

This documentation applies to the following versions of Splunk Cloud: 7.0.11, 7.0.13, 7.2.7, 7.2.9, 7.2.8, 7.2.10, 8.0.2001, 8.0.2003, 8.0.2004, 8.0.2006, 8.0.2007, 8.1.2008, 8.1.2009

Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters