On this page
rename command
Rename a field in the result set. Display-only - stored events are untouched.
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
| Argument | Required | Description |
|---|---|---|
<field> | Required | The field to rename. It does not have to be projected first; any field the events carry can be renamed. |
AS <new name> | Required | The 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,@timestampand_timeall name the event time. Renaming it on raw events adds the new name as a copy and keepstimestamp.
Examples
1. Rename one field
ObiQL
| rename src_ip AS client_ipThe 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, messageLater stages refer to the field by its new name.