Documentation

tail() function

The tail() function limits each output table to the last n records. The function produces one output table for each input table. Each output table contains the last n records before the offset. If the input table has less than offset + n records, tail() outputs all records before the offset.

Function type: Filter

tail(
  n:10,
  offset: 0
)

Parameters

n

The maximum number of records to output.

Data type: Integer

offset

The number of records to skip at the end of a table table before limiting to n. Defaults to 0.

Data type: Integer

Examples

Output the last ten records in each table
from(bucket:"example-bucket")
  |> range(start:-1h)
  |> tail(n:10)

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: