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.

Function Summary
Signaturedrop(fields, [mode])
Output DataZero or One Event per Input Event
Function TypeTransformation
Transformation
Compatible ContextQuery, Live Query, Aggregate Alert, Filter Alert, Legacy Alert, Parser, Non-aggregate Query
Parameters for drop()
ParameterTypeInterpreted TypeRequiredDefault ValueDescription
fields[a]array of stringsarray of fieldnamesrequired ย  The names of the fields to discard. When mode is glob, the entries are glob patterns, including array patterns such as errors[*].
modestringfixed valuesoptional[b] exact The method to use when matching field names. (added in 1.267)
ย ย ย ย Values
ย ย ย ย exactThe function matches field names exactly.
ย ย ย ย globThe 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.

[a] The parameter name fields can be omitted.

[b] Optional parameters use their default value unless explicitly set.

Hide omitted argument names for this function

Show omitted argument names for this function

drop() Syntax Examples

Remove specific field from event set:

This example drops the field f1 from the event set.

logscale
drop(f1)

If input data was f1=a, f2=b, f3=c, it would return:

f2f3
bc

Remove multiple fields from event set:

This example drops the fields f2 and f3 from the event set.

logscale
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.

logscale
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.

logscale
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.

logscale
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_codeerr_db_conn_codehost
23web1

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.

logscale
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.

logscale
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].nameevents[1].name
loginlogout

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
logscale
drop(header)
Introduction

In this example, the drop() function is used to remove the header field from result set.

Step-by-Step
  1. Starting with the source repository events.

  2. logscale
    drop(header)

    Drops a single field named header.

  3. 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
logscale
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
  1. Starting with the source repository events.

  2. logscale
    drop([header,value])

    Drops both the field named header and the field named value.

  3. 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
logscale
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:

@timestampheadermessagestatusvalueuser_id
2025-09-15T10:00:00ZHTTP/1.1User login successful200temp_datauser123
2025-09-15T10:00:01ZHTTP/1.1File uploaded201cache_infouser456
2025-09-15T10:00:02ZHTTP/2.0Authentication failed401debug_valuser789
2025-09-15T10:00:03ZHTTP/1.1Data retrieved200session_iduser123
2025-09-15T10:00:04ZHTTP/2.0Connection timeout408retry_countuser456
Step-by-Step
  1. Starting with the source repository events.

  2. 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.

  3. 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:

@timestampmessagestatususer_id
2025-09-15T10:00:00ZUser login successful200user123
2025-09-15T10:00:01ZFile uploaded201user456
2025-09-15T10:00:02ZAuthentication failed401user789
2025-09-15T10:00:03ZData retrieved200user123
2025-09-15T10:00:04ZConnection timeout408user456

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
logscale
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:

@timestampheadermessagestatususer_id
2025-09-15T10:00:00ZHTTP/1.1User login successful200user123
2025-09-15T10:00:01ZHTTP/1.1File uploaded201user456
2025-09-15T10:00:02ZHTTP/2.0Authentication failed401user789
2025-09-15T10:00:03ZHTTP/1.1Data retrieved200user123
2025-09-15T10:00:04ZHTTP/2.0Connection timeout408user456
Step-by-Step
  1. Starting with the source repository events.

  2. 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.

  3. 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:

@timestampmessagestatususer_id
2025-09-15T10:00:00ZUser login successful200user123
2025-09-15T10:00:01ZFile uploaded201user456
2025-09-15T10:00:02ZAuthentication failed401user789
2025-09-15T10:00:03ZData retrieved200user123
2025-09-15T10:00:04ZConnection timeout408user456

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.