Browse docs
On this page

limit command

Cap the number of rows returned.

All ObiQL commands

Caps the number of rows the query returns, keeping the first ones under the current order.

Syntax

ObiQL
| limit <count>

Square brackets mark an optional part, and angle brackets a value you supply.

Arguments

ArgumentRequiredDescription
<count>RequiredA whole number of rows to keep.

Usage

  • limit caps result rows. The limit= option on timechart is different: it controls how many series a chart draws.
  • After dedup, limit counts the rows that survive, so | dedup service | limit 20 means twenty distinct services.

Examples

1. Top ten routes by traffic

ObiQL
| stats count() by route | sort -count | limit 10

Sort first so the limit keeps the largest rows.

2. The latest few errors

ObiQL
level="error" | limit 5

Events come back newest first, so this is the five most recent errors.