exclude

Removes specified array elements or object keys.

Syntax

exclude(<source>, <excluded>)

Arguments

ArgumentTypeDescription
<source>array or objectArray or object to filter.
<excluded>arrayArray values or object keys to remove. For objects, non-string entries are ignored.

Returns

Returns the same type as <source>.

  • For arrays, removes every matching element, including NULL. Retained elements keep their order and duplicates.
  • For objects, removes the listed top-level keys. Nested keys are unchanged.
  • If nothing remains, returns [] or {}.
  • If either input is NULL, returns NULL.

Examples

Remove routine labels from an alert

Keep the labels that are relevant to triage by excluding routine markers.

SELECT exclude(
    ['checkout', 'heartbeat', 'timeout', 'debug'],
    ['heartbeat', 'debug']
) AS alert_labels
+------------------------+
| alert_labels           |
+------------------------+
| ["checkout","timeout"] |
+------------------------+

Remove fields from an exported summary

Exclude selected top-level keys when preparing a smaller event object for a report.

SELECT exclude(
    {'order_id': 'o-17', 'status': 'paid', 'debug': 'cache-hit'},
    ['debug']
) AS summary
+-------------------------------------+
| summary                             |
+-------------------------------------+
| {"order_id":"o-17","status":"paid"} |
+-------------------------------------+