nano SIEM
Search Commands

chart

Supported in:Self-hosted

Aggregate events for a chart, with an `over` axis field and `by` split fields.

Use chart to aggregate your events for a chart. Choose an over field for the axis and by fields to split the series.

Syntax

... | chart <agg> [as <name>] [, <agg> ...] [over <field> ...] [by <field> ...]
PartDescription
aggAny stats aggregation, such as count, dc(f), avg(f).
overThe axis field (the x-axis of a bar or column chart).
bySplit fields (one series per value).

You can start a query with chart and no pipe.

How it works

  • chart aggregates exactly like stats. The over fields come first, then the by fields, and together they form the grouping.
  • The result is one row per combination of over and by values (long format). The chart view draws the over field on the axis and one series per by value.
  • Rows are ordered by the first aggregation, descending, like stats.

Examples

HTTP status codes per method:

class_uid=4002 | chart count over http_request.http_method by http_response.code

Failed logons per host, split by logon type:

class_uid=3002 status_id=2 | chart count over device.hostname by logon_type

Bytes sent per destination port:

class_uid=4001 | chart sum(traffic.bytes_out) as sent_bytes over dst_endpoint.port

CloudTrail calls per service, split by region:

metadata.log_source=aws_cloudtrail | chart count over api.service.name by cloud.region

Without over, chart ... by behaves like stats ... by:

class_uid=1007 | chart dc(process.name) as distinct_processes by device.hostname

Notes

  • For an aggregation per time bucket, use timechart.

What's next

  • stats: the full list of aggregations
  • timechart: aggregate over time
  • top: most common values with percentages

On this page