Home / Search/ Language Reference/ Commands/.generate stats

.generate stats

The .generate stats command produces statistics about the results of a search.

// produce statistics for the search 1749594773597.yzoXZy, if available to the current user
.generate stats job("1749594773597.yzoXZy")

Purpose

A standard Cribl Search query generates two types of statistics about its result set:

  • Timeline stats: Distribution of data over time, such as the number of events per time bucket, or the earliest and latest timestamps in the result set. You can see these stats in the histogram of the search results.
  • Field stats: Distribution of data across fields, such as the number of unique values in a field, or the minimum and maximum values of a field. You can see these stats in the field browser of the search results.

Certain types of searches (for example, Dashboard or scheduled searches) don’t generate these statistics by default, to optimize performance.

The .generate stats command allows you to generate these statistics for any search, without having to rerun the search itself.

Permissions

Search Member TypePermissions
AdminCan generate stats for all searches in the Organization.
Editor or UserCan generate stats for public searches, or searches that they ran themselves.

Syntax

.generate [timeline|field|all] stats("SearchId") [force] [with(reason = "InvestigationReason")]

Parameters

ParameterRequiredDescription
timeline or field or allNoType of statistics to generate. Use timeline for timeline stats, field for field stats, or all for both. If omitted, defaults to all.
SearchIdYesThe ID of the search for which to generate statistics. Doesn’t support wildcards.
forceNoForce the (re)generation of stats even if they were already generated.
Investigation ReasonNoThe reason for running the command, added to the Cribl Search audit log.

Returns

Returns a message indicating whether the statistics were successfully generated or not.

If the search ID is invalid or the user doesn’t have permission to access the search, returns an error message.

Examples

Generate timeline statistics for a search, overwriting any existing stats.

.generate timeline stats("1749594773597.yzoXZy") force with (reason="I have my reasons");