Event Canal

The Event Canal microservice provides the foundation for streaming analytics of events. The Event Canal microservice is responsible for taking real-time events from the Event database and enqueueing them to an Apache Pulsar topic. Multiple microservices can read from this same topic to create analytics pipelines for enrichment, suppression, north-bound integrations, or machine learning.

This microservice is part of the Event microservice pipeline. See Understanding the Event Pipeline in Unified Assurance Concepts for conceptual information.

This microservice provides additional Prometheus monitoring metrics. See Event Canal Self-Monitoring Metrics.

Event Canal Prerequisites

Before deploying the microservice, confirm that the following prerequisites are met:

  1. A microservice cluster is set up. See Microservice Cluster Setup.

  2. The Pulsar microservice is deployed. See Pulsar.

Deploying Event Canal

To deploy the microservice, run the following commands:

su - assure1
export NAMESPACE=<namespace>
export WEBFQDN=<WebFQDN> 
a1helm install <microservice-release-name> assure1/event-canal -n $NAMESPACE --set global.imageRegistry=$WEBFQDN

In the commands:

You can also use the Unified Assurance UI to deploy microservices. See Deploying a Microservice by Using the UI for more information.

Changing Event Canal Configuration Parameters

When running the install command, you can optionally change default configuration parameter values by including them in the command with additional --set arguments. You can add as many additional --set arguments as you need.

For example, set a parameter described in Default Event Canal Configuration by adding --set configData.<parameter_name>=<parameter_value>. For example, --set configData.LOG_LEVEL=DEBUG.

Default Event Canal Configuration

The following table describes the default configuration parameters found in the Helm chart under configData for the microservice.

Name Default Value Possible Values Notes
LOG_LEVEL INFO FATAL, ERROR, WARN, INFO, DEBUG Logging level used by application.
STREAM_INPUT mysql:///Event Text, 255 characters Do not change this. Not configurable.
STREAM_OUTPUT persistent://assure1/event/canal Text, 255 characters Apache Pulsar topic path. Topic at end of path may be any text value. In multi-server environments, ensure that microservices consume messages from only one cluster at a time.
REPL_GTID_INVALID_STREAM_ALL_EVENTS false true or false When the saved global transaction identifier (GTID) is invalid because it has been purged, whether to start streaming from the oldest available binlog event (true), or the most recent binlog event (false).

About Event Canal and the MySQL binlog

The MySQL Event database binary log files (binlog) record of all inserts, updates, and deletes on the MySQL server. The binlog supports replication and data recovery. Binlog entries include global transaction identifiers (GTIDs), which identify MySQL transactions.

The Event Canal microservice listens to binlog events for the Event database. When you first deploy it, it starts streaming from the most recent GTID and saves the GTID, binlog file name, and position in the file to the database. When a pod restarts, Event Canal gets the GTID from the database to determine the last binlog file position. If that GTID is still valid, it starts streaming events from that point on. If the GTID is invalid or does not exist anymore, Event Canal checks the REPL_GTID_INVALID_STREAM_ALL_EVENTS configuration parameter to determine where to start:

For more information about binlog and using GTIDs, see The Binary Log and Replication with Global Transaction Identifiers in MySQL Reference Manual.

Event Canal Self-Monitoring Metrics

The Event Canal microservice exposes the self-monitoring metrics described in the following table to Prometheus.

Metric Name Type Description
total_events_processed Counter Number of events processed
processing_time_per_event Gauge Processing time per event from receiving it to sending it to acknowledging it
total_binlog_events_received Counter The total number of binlog events received

Note:

Metric names in the database include a prefix that indicates the service that inserted them. The prefix is prom_ for metrics inserted by Prometheus. For example, total_events_processed is stored as prom_total_events_processed in the database.

Sample JSON Event Schema

Event data is normalized into a common JSON schema. The sample schema below shows the default fields, but any custom fields you add to the Event.Events table will automatically be included in the JSON.

Some fields are converted from their native format into ones appropriate for consumers of the output topic.

{
  "@timestamp": "2006-01-02T15:04:05Z",
  "_domain": "fault",
  "_type": "event",
  "_version": "5.0.0",
  "_agents": [
    {
      "app": "event-canal",
      "output": "persistent://assure1/event/canal",
      "cluster": "<name of the cluster>",
      "node": "<Host FQDN>",
      "input": "mysql:///Event",
      "@timestamp": "2024-08-13T15:12:33Z",
      "host": "<host inet address>",
      "id": "<pod id>",
      "version": "5.0.0"
    }
  ],
  "event": {
    "EventID": 0,
    "EventKey": "",
    "EventCategory": 3,
    "EventType": "",
    "Ack": 0,
    "Action": "",
    "Actor": "",
    "Count": 1,
    "Customer": "",
    "Department": "",
    "Details": {},
    "DeviceType": "",
    "Duration": 0,
    "EscalationFlag": 0,
    "ExpireTime": 0,
    "FirstReported": "2006-01-02T15:04:05.999999999Z",
    "GeoPath": {
      "type": "LineString",
      "coordinates": [
        [
          0.0,
          0.0
        ],
        [
          0.0,
          0.0
        ]
      ]
    },
    "GeoLocation": {
      "type": "Point",
      "coordinates": [
        0.0,
        0.0
      ]
    },
    "IPAddress": "",
    "LastChanged": "2006-01-02T15:04:05.999999999Z",
    "LastReported": "2006-01-02T15:04:05.999999999Z",
    "Location": "",
    "Method": "",
    "Node": "",
    "OrigSeverity": 1,
    "OwnerName": "",
    "RootCauseFlag": 0,
    "RootCauseID": 0,
    "Score": 0,
    "Service": "",
    "ServiceImpact": 0,
    "Severity": "Unknown",
    "SubDeviceType": "",
    "SubMethod": "",
    "SubNode": "",
    "Summary": "",
    "TicketFlag": 0,
    "TicketID": "",
    "ZoneID": 0
  }
}