Skip to main content

MQTT Recorder Module - Usage and Configuration

After installing MQTT Recorder, you can configure a database connection and define how incoming records are written to database tables.

How MQTT Recorder Works​

MQTT Recorder receives records from MQTT Engine and automatically stores them in a configured database.

Records are published using Sparkplug record topics such as:

spBv1.0/group/NRECORD/edgenode
spBv1.0/group/DRECORD/edgenode/device

Each record contains a Record Type and associated fields that MQTT Recorder uses to create database tables and insert rows automatically.

For example, a record may contain information for events, alarms, or historical process data received from remote devices.

Configure General Settings​

The General tab contains the settings used to enable MQTT Recorder and select a database connection.

Enable MQTT Recorder​

  1. Navigate to Config → MQTT Recorder → General.
  2. Verify that Enabled is selected.
  3. Click Save Changes.

Select a Database Connection​

  1. Select a database connection from the Datasource dropdown.
  2. Click Save Changes.

The list of available datasources is populated from the database connections configured in the Ignition Gateway.

Configure Table Partitioning​

The Partition Period setting controls how MQTT Recorder creates database tables over time.

Partition PeriodExample Table Name
Nonealarm
Hourlyalarm_2022_12_10_02
Dailyalarm_2022_12_10
Weeklyalarm_2022_49
Monthlyalarm_2022_12
Yearlyalarm_2022

Partitioning can be useful when storing large volumes of historical data.

Configure Table Mappings​

The Tables tab controls how records are mapped to database tables.

By default, MQTT Recorder creates a single table definition:

rs_${type}

With this configuration, a separate database table is automatically created for each unique Record Type.

Example:

rs_Event
rs_Alarm
rs_History

Create a Custom Table Mapping​

You can create custom table names using dynamic tokens.

Available Tokens​

TokenDescription
${type}Record Type
${group}Sparkplug Group ID
${edgenode}Sparkplug Edge Node ID
${device}Sparkplug Device ID
${field:<name>}Value of a record field

Example:

AAA_${group}_BBB_${edgenode}_${type}

Table Settings​

Each table mapping can optionally filter records before inserting them into a database table.

SettingDescription
EnabledEnables or disables the table definition.
Record TypeOnly records matching the specified Record Type are inserted.
Group IDOnly records from the specified Sparkplug Group ID are inserted.
Edge Node IDOnly records from the specified Edge Node ID are inserted.
Device IDOnly records from the specified Device ID are inserted.
Field FiltersFilters records based on field values.

Configure Field Filters​

Field Filters allow records to be routed to tables based on field values.

Field filters use one of the following formats:

  • {<field>:<operator>:<value>}
  • {<field>:NULL}
  • {<field>:NOTNULL}

Supported operators:

  • ==
  • !=
  • >
  • <
  • >=
  • <=

Note

Values containing :, ;, or \ must be escaped with a leading backslash (\).

Verify Operation​

After MQTT Recorder is enabled:

  1. Confirm records are being received by MQTT Engine.
  2. Verify that tables are created in the configured database.
  3. Confirm that new rows are being inserted as records are received.

The table names and structure are automatically generated based on the configured table mappings and incoming record data.


Tags​

MQTT Recorder automatically creates a set of tags used for signature validation.

MQTT Recorder Control​

Signature Validation​

The Signature Validation tags can be used to verify that records stored in the database were written using the expected hashing algorithm and have not been modified.

NameData TypeDescription
Request Hashing AlgorithmStringWritable tag used to specify the hashing algorithm for validation.
Request Index StartLongFirst record index included in the validation request.
Request Index EndLongLast record index included in the validation request.
Request PasswordStringDatabase password used during validation.
Request Table NameStringName of the table containing the records to validate.
ResultDatasetDataset containing validation results for each record.
StatusStringIndicates whether the validation request completed successfully. If the value is Success, the Result dataset contains validation details.
ValidateBooleanWritable tag that triggers signature validation.
Result Dataset​

The Result dataset contains the following columns:

Column NameData TypeDescription
indexLongRecord index.
signatureStringRecord signature.
validatedBooleanIndicates whether the record signature matches the calculated signature.
errorStringError message generated during validation, if any.