Available: Glob patterns in drop()
v1.267.0
From v1.267.0, drop() supports glob
patterns when you set mode to
glob.
Removes specified fields from each event.
By default, drop() matches field names
exactly. Set mode to
glob to drop multiple fields with a
pattern instead of listing each field.
Note
Glob matching in drop() is non-greedy.
The * character stops at the first
occurrence of the character that follows it in the pattern.
For example, err_*_code matches
err_internal_code but not
err_external_reference_code.
| Signature | drop(fields, [mode]) |
| Output Data | Zero or One Event per Input Event |
| Function Type | Transformation |
| Compatible Context | Query, Live Query, Aggregate Alert, Filter Alert, Legacy Alert, Parser, Non-aggregate Query |
drop()| Parameter | Type | Interpreted Type | Required | Default Value | Description |
|---|---|---|---|---|---|
fields[a] | array of strings | array of fieldnames | required | ย | The names of the fields to discard. When mode is glob, the entries are glob patterns, including array patterns such as errors[*]. |
mode | string | fixed values | optional[b] | exact | The method to use when matching field names. (added in 1.267) |
| ย | ย | ย | ย | Values | |
| ย | ย | ย | ย | exact | The function matches field names exactly. |
| ย | ย | ย | ย | glob | The function interprets each entry in fields as a
glob pattern. The * character matches
characters up to the first occurrence of the character that
follows it in the pattern. The match is non-greedy and does not
backtrack. For example, err_*_code matches
err_internal_code but not
err_external_reference_code. |
[b] Optional parameters use their default value unless explicitly set. | |||||
Hide omitted argument names for this function
Omitted Argument NamesThe argument name for
fieldscan be omitted; the following forms of this function are equivalent:logscale Syntaxdrop("value")and:
logscale Syntaxdrop(fields="value")These examples show basic structure only.
drop() Syntax Examples
Remove specific field from event set:
This example drops the field f1 from the event set.
drop(f1)
If input data was f1=a,
f2=b, f3=c, it would
return:
| f2 | f3 |
|---|---|
| b | c |
Remove multiple fields from event set:
This example drops the fields f2 and f3 from the event set.
drop([f2, f3])
If input data was f1=a,
f2=b, f3=c, it would
return:
| f1 |
|---|
| a |
Remove fields that match a glob pattern:
This example drops all fields whose names start with
error_, such as
error_code,
error_msg, and
error_source.
drop(fields=["error_*"], mode=glob)
If input data was error_code=500,
error_msg=timeout,
error_source=db,
host=web1, it would return:
| host |
|---|
| web1 |
Remove fields that match multiple glob patterns:
This example drops all fields that start with
tmp_ and all fields that end with
_internal.
drop(fields=["tmp_*", "*_internal"], mode=glob)
If input data was tmp_a=1,
tmp_b=2, id_internal=x,
user=alice, it would return:
| user |
|---|
| alice |
Remove fields with a non-greedy glob pattern:
In glob mode, the * character stops at the
first occurrence of the character that follows it in the
pattern. This example drops
err_internal_code, but keeps
err_external_reference_code and
err_db_conn_code because the
* stops at the first underscore.
drop(fields=["err_*_code"], mode=glob)
If input data was err_internal_code=1,
err_external_reference_code=2,
err_db_conn_code=3,
host=web1, it would return:
| err_external_reference_code | err_db_conn_code | host |
|---|---|---|
| 2 | 3 | web1 |
The same rule applies to array patterns. The pattern
errors[*].code drops
errors[0].code and
errors[1].code, but keeps
errors[0].internal[0].code.
Remove all entries of an array:
This example drops all entries of the errors array, including entries with non-contiguous indices.
drop(fields=["errors[*]"], mode=glob)
If input data was errors[0]=a,
errors[2]=b,
errors[5]=c, host=web1,
it would return:
| host |
|---|
| web1 |
Remove specific sub-fields from an object array:
This example drops the severity and internal_id sub-fields from all entries of the events array.
drop(fields=["events[*].severity", "events[*].internal_id"], mode=glob)
If input data was events[0].severity=high,
events[0].internal_id=7,
events[0].name=login,
events[1].severity=low,
events[1].internal_id=8,
events[1].name=logout, it would return:
| events[0].name | events[1].name |
|---|---|
| login | logout |
drop() Examples
Click next to an example below to get the full details.
Drop Attributes, Columns/Fields From Result Set - Example 1
Drop a single field from a result set using the
drop() function
Query
drop(header)Introduction
In this example, the drop() function is used to
remove the header field from
result set.
Step-by-Step
Starting with the source repository events.
- logscale
drop(header)Drops a single field named header.
Event Result set.
Summary and Results
The query is used to remove data during ingest, in this example removing
a field. Removal of fields are useful if you have created fields in
sub-searches (extracted some values in new fields during the filtering
process) that are no longer needed in the final result set. If you want
to drop an entire event, it is possible to use the
dropEvent() function.
Drop Attributes, Columns/Fields From Result Set - Example 2
Drop two fields from a result set using the
drop() function
Query
drop([header,value])Introduction
In this example, the drop() function is used to
remove the fields header and
value from result set.
Step-by-Step
Starting with the source repository events.
- logscale
drop([header,value])Drops both the field named header and the field named value.
Event Result set.
Summary and Results
The query is used to remove data during ingest, in this example removing
more fields. Removal of fields are useful if you have created fields in
sub-searches (extracted some values in new fields during the filtering
process) that are no longer needed in the final result set. If you want
to drop an entire event, it is possible to use the
dropEvent() function.
Drop Multiple Fields from Events
Remove multiple fields from all events using an array and the
drop() function
Query
drop([header,value])Introduction
In this example, the drop() function is used to
remove both the header and
value fields from all events in
the dataset using an array syntax.
Example incoming data might look like this:
| @timestamp | header | message | status | value | user_id |
|---|---|---|---|---|---|
| 2025-09-15T10:00:00Z | HTTP/1.1 | User login successful | 200 | temp_data | user123 |
| 2025-09-15T10:00:01Z | HTTP/1.1 | File uploaded | 201 | cache_info | user456 |
| 2025-09-15T10:00:02Z | HTTP/2.0 | Authentication failed | 401 | debug_val | user789 |
| 2025-09-15T10:00:03Z | HTTP/1.1 | Data retrieved | 200 | session_id | user123 |
| 2025-09-15T10:00:04Z | HTTP/2.0 | Connection timeout | 408 | retry_count | user456 |
Step-by-Step
Starting with the source repository events.
- logscale
drop([header,value])Removes both the header and value fields from all events using array syntax. The
drop()function accepts an array of field names enclosed in square brackets, allowing multiple fields to be eliminated simultaneously in a single operation. Event Result set.
Summary and Results
The query is used to remove multiple fields (header and value) from all events in the dataset in a single operation.
This query is useful, for example, to clean up log data by removing multiple redundant fields at once, eliminate several sensitive or temporary fields before data export, or reduce data volume efficiently by dropping multiple unnecessary metadata fields simultaneously.
Sample output from the incoming example data:
| @timestamp | message | status | user_id |
|---|---|---|---|
| 2025-09-15T10:00:00Z | User login successful | 200 | user123 |
| 2025-09-15T10:00:01Z | File uploaded | 201 | user456 |
| 2025-09-15T10:00:02Z | Authentication failed | 401 | user789 |
| 2025-09-15T10:00:03Z | Data retrieved | 200 | user123 |
| 2025-09-15T10:00:04Z | Connection timeout | 408 | user456 |
Note that once fields are dropped, they cannot be recovered in
subsequent operations within the same query. Both the
header and
value fields are completely
removed from all events. Using array syntax is more efficient than
multiple separate drop() operations.
Drop Single Field from Events
Remove the header field from all events using the
drop() function
Query
drop(header)Introduction
In this example, the drop() function is used to
remove the header field from all
events in the dataset.
Example incoming data might look like this:
| @timestamp | header | message | status | user_id |
|---|---|---|---|---|
| 2025-09-15T10:00:00Z | HTTP/1.1 | User login successful | 200 | user123 |
| 2025-09-15T10:00:01Z | HTTP/1.1 | File uploaded | 201 | user456 |
| 2025-09-15T10:00:02Z | HTTP/2.0 | Authentication failed | 401 | user789 |
| 2025-09-15T10:00:03Z | HTTP/1.1 | Data retrieved | 200 | user123 |
| 2025-09-15T10:00:04Z | HTTP/2.0 | Connection timeout | 408 | user456 |
Step-by-Step
Starting with the source repository events.
- logscale
drop(header)Removes the header field from all events. The
drop()function permanently eliminates the specified field from the event data, reducing the amount of data stored and processed in subsequent operations. Event Result set.
Summary and Results
The query is used to remove the header field from all events in the dataset.
This query is useful, for example, to clean up log data by removing redundant protocol information, eliminate sensitive fields before sharing data, or reduce data volume by dropping unnecessary metadata fields.
Sample output from the incoming example data:
| @timestamp | message | status | user_id |
|---|---|---|---|
| 2025-09-15T10:00:00Z | User login successful | 200 | user123 |
| 2025-09-15T10:00:01Z | File uploaded | 201 | user456 |
| 2025-09-15T10:00:02Z | Authentication failed | 401 | user789 |
| 2025-09-15T10:00:03Z | Data retrieved | 200 | user123 |
| 2025-09-15T10:00:04Z | Connection timeout | 408 | user456 |
Note that once a field is dropped, it cannot be recovered in subsequent operations within the same query. The header field is completely removed from all events.