Represent the data as a table.

Specify a list of fields to select. Columns in the table are sorted in the specified field order. This is an aggregate function and it will limit the number of events returned using the limit parameter. It is possible to specify how the table is sorted using the field parameter.

See the select() function for a similar tabular output, which does not limit the number of events returned and does not sort the result, and is thus better suited for exporting large amount of data to a file.

Function Traits: Aggregate

ParameterTypeRequiredDefaultDescription
fields[a]Array of stringsrequired  The names of the fields to select.
limitnumberoptional200 Limit result size.
orderArray of stringsoptionaldesc Order to sort in.
  Valid ValuesascAscending (A-Z, 0-9) order
   descDescending (Z-A, 9-0) order
reversebooleanoptional  Whether to sort in descending order. Deprecated: prefer order instead.
sortbyArray of stringsoptional@timestamp Names of fields to sort by.
typeArray of stringsoptionalany Type of the fields to sort.
  Valid ValuesanyAny fields
   hexHexaedecimal fields
   numberNumerical fields
   stringString fields

[a] The argument name fields can be omitted.

The parameter name for fields can be omitted; the following forms are equivalent:

logscale
table("value")

and:

logscale
table(fields="value")

table() Examples

Look at HTTP GET methods and create a table with the fields statuscode and responsetime

logscale
method=GET
| table([statuscode, responsetime])

Show name and responsetime of the 50 slowest requests

logscale
table([name, responsetime], sortby=responsetime, limit=50, order=asc)