alert

Generates Logpresso Sonar events from input records. Use this command in real-time stream queries to convert detection rule results into Sonar events.

Command properties

ItemDescription
Command typeProcessing query
Required permissionNone
License usageN/A
Parallel executionNot supported
Distributed executionRuns on Data Node (mapper)

Syntax

alert

Input fields

FieldTypeRequiredDescription
_loggerintegerRequiredLogger ID
_ruleintegerRequiredDetection rule ID
_sitestringOptionalSite name
_logger_namestringOptionalLogger name
_device_ipipaddrOptionalDevice IP address
_device_namestringOptionalDevice name

Error codes

Parse errors

N/A

Runtime errors

N/A

Description

The alert command reads the _logger and _rule fields from each input record and generates a Sonar event. Both fields must exist as numeric types for an event to be created. If either field is missing or has the wrong type, the record passes through to the next command unchanged without generating an event.

All fields from the input record are included in the event data. The _site, _logger_name, _device_ip, and _device_name fields are set as supplementary event metadata. The event source is set to STREAM.

Regardless of whether an event is generated, the input record is always passed through to the next command as-is.

Examples

  1. Generating events in a stream query

    json "[{'_logger': 1, '_rule': 100, 'src_ip': '192.0.2.1', 'action': 'blocked'}]"
    | alert
    

    Creates a Sonar event from a record that contains the _logger and _rule fields.

  2. Missing required fields

    json "[{'src_ip': '192.0.2.1', 'action': 'blocked'}]"
    | alert
    

    Because the _logger and _rule fields are absent, no event is generated and the record passes through unchanged.