Browse docs
On this page

rename command

Rename a field in the result set. Display-only - stored events are untouched.

All ObiQL commands

Renames fields in the result set. Stages after it use the new name. Stored events are not changed.

Syntax

ObiQL
| rename <field> AS <new name> [, <field> AS <new name> ...]

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

Arguments

ArgumentRequiredDescription
<field>RequiredThe field to rename. It does not have to be projected first; any field the events carry can be renamed.
AS <new name>RequiredThe new name. Quote it to include a space: AS "Client IP".

Usage

  • Once renamed, the old name is retired. A later stage that still uses it is an error that names the new one.
  • After stats, only the aggregate's output columns can be renamed.
  • timestamp, @timestamp and _time all name the event time. Renaming it on raw events adds the new name as a copy and keeps timestamp.

Examples

1. Rename one field

ObiQL
| rename src_ip AS client_ip

The column appears as client_ip.

2. A display name with a space

ObiQL
| stats count() by service | rename count() AS "Total Runs"

After stats, an aggregate can be renamed by the way it was written.

3. Use the new name downstream

ObiQL
| rename src_ip AS client_ip | where client_ip="10.0.0.1" | fields client_ip, message

Later stages refer to the field by its new name.