tstats command: Examples

Examples for using the SPL2 tstats command

Counting the fields using the default tstats settings

The following example specifies only the required parameters. Aggregates must be enclosed in square brackets ( [ ] ). However, because no indexes are specified, the search performs a count of the fields for all of the indexes in the module.

CODE

Renaming aggregate function expressions

The following example shows that you can rename the aggregate using the AS keyword. Without renaming, the search results would display the aggregate expression min(_time).

CODE

Specifying a data model in the tstats command

The following example specifies an aggregate and a data model. Because there is a period between the data module name and the root dataset name, the datamodel_name value must be enclosed in single quotation marks:

CODE

Specifying the target dataset name in the predicate in a data model

The following example shows how to specify the target dataset name in the predicate in a data model:

CODE

Specifying multiple predicates using the AND logical operator

The following example shows how to specify multiple predicates using the AND logical operator:

CODE

Grouping results using the byfields argument

The following example shows how to specify a byfields value, which must be enclosed in square brackets ( [ ] ):

CODE

Specifying multiple aggregates in the tstats command

The following example shows how to specify multiple aggregates in the tstats command:

CODE

See also