nano SIEM
Search Commands

timechart

Supported in:Self-hosted

Aggregate events into fixed time buckets, optionally split into one series per field value.

Use timechart to summarize your events in fixed time buckets. You can split the results into a series for each value of a field.

Syntax

... | timechart [span=<duration>] [limit=<N>] [cont=<bool>] [useother=<bool>] <agg> [as <name>] [, <agg> ...] [by <field>]
OptionDefaultDescription
span1hBucket size: a number plus s, m, h or d (30s, 5m, 1h, 1d).
aggAny stats aggregation, such as count, dc(f), sum(f).
bySplit field. Each value becomes its own series.
limitall seriesKeep only the top N series, ranked by the first aggregation over the whole range.
useothertrueWith limit, add the remaining series together as an OTHER series. useother=false drops them.
contfalsecont=true adds zero-valued rows for empty buckets so lines don't skip gaps.

span, limit, cont and useother can come before the aggregations; limit, cont and useother can also follow the by field. You can start a query with timechart and no pipe.

How it works

  • Buckets align to the clock: a 5m span starts at :00, :05, :10. The bucket start is in the time_bucket column.
  • Without by, each aggregation is one column per bucket.
  • With by, each split value becomes a series column in the result.
  • Buckets with no events are left out unless you set cont=true.

Examples

Event volume per hour:

* | timechart count

Failed logons every 15 minutes, per user, top 5 users only:

class_uid=3002 status_id=2 | timechart span=15m count by user.name limit=5 useother=false

HTTP status codes over time, with the rest grouped as OTHER:

class_uid=4002 | timechart span=15m count by http_response.code limit=5

Server errors and total requests side by side:

class_uid=4002 | timechart span=5m count as total, count(eval(http_response.code>=500)) as errors

Outbound bytes per hour, with empty hours as zero:

class_uid=4002 | timechart span=1h cont=true sum(traffic.bytes_out) as sent_bytes

Distinct hosts reporting per day, by log source:

timechart span=1d dc(device.hostname) as hosts by metadata.log_source

Notes

  • span units are s, m, h and d only. For a week, use span=7d.
  • For buckets you then aggregate yourself (for example to feed anomaly), use bin and stats.
  • timechart runs after a lookup, prevalence, inputlookup, resolve_identity, or ai stage too.

What's next

  • bin: put events into time or numeric buckets
  • stats: aggregate without time buckets
  • chart: aggregate with over / by fields

On this page