Replaces a field value with higher-level grouping, such as replacing filenames with directories.
bucketdir pathfield=<field> sizefield=<field> [maxcount=<int>] [countfield=<field>] [sep=<char>]
- 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.
- 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: Specify either "/" or "\\" as the separating character. This depends on the operating system.
Returns at most 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 SEP character. The default pathfield=source; sizefield=totalCount; maxcount=20; countfield=totalCount; sep="/" or "\\", depending on the os.
Example 1: Get 10 best sources and directories.
... | top source | bucketdir pathfield=source sizefield=count maxcount=10
Have questions? Visit Splunk Answers and see what questions and answers the Splunk community has using the bucket command.
This documentation applies to the following versions of Splunk: 4.1 , 4.1.1 , 4.1.2 , 4.1.3 , 4.1.4 , 4.1.5 , 4.1.6 , 4.1.7 , 4.1.8 , 4.2 , 4.2.1 , 4.2.2 , 4.2.3 , 4.2.4 , 4.2.5 , 4.3 , 4.3.1 , 4.3.2 , 4.3.3 , 4.3.4 , 4.3.5 , 4.3.6 , 5.0 , 5.0.1 , 5.0.2 , 5.0.3