# Data Stream Handlers

# System event labels for data streams

When events pass through the "Event Preprocessor", in addition to directly processing data, it is also possible to add special tags (labels).

Labels allow you to enrich incoming data with additional service information.

On the "Primary Events" screen, labels are represented as fields _labels.*

To work with labels, there are several commands that are called from the script editor.

# Add key:value to event labels

To add labels, use the function - labels_add(string key, object data) It adds additional information to custom labels. If there is data for such a key, the data is combined.

# Arguments

key - key name data - value as string or luaTable.

# Example of adding a label

Adds a 'postRoutings' label with the values 'cl.stream-ready-event.new1', 'cl.stream-ready-event.new2'.

labels_add('postRoutings',{'cl.stream-ready-event.new1', 'cl.stream-ready-event.new2'})

Adds a 'type' label with the value 'Zabbix'.

labels_add('type', 'Zabbix')

# Clear label data

To clear the labels, use the function - labels_clear()

The function clears all label data completely.

# Label cleanup example

Clears all data in labels.


# Delete label by key

To delete a label by key, use the function - labels_remove(string key) Removes data from labels for the specified key.

# Arguments

key - key name

# Example of deleting a label

Removes the label with the key name postRoutings.