Skip to content

X-Road: Message Log Data Model

Version: 1.11 Doc. ID: DM-ML

DateVersionDescriptionAuthor
21.08.20150.1Initial versionMait Märdin
25.08.20150.2Resolved a few TODOsSiim Annuk
10.09.20150.3Added corrections and commentsMargus Freudenthal
14.09.20150.4Added more informative textSiim Annuk
16.09.20150.5Cleaned up a bit and added some documentationMargus Freudenthal
16.09.20150.6PostgreSQL version 9.4 is used nowMartin Lind
16.09.20150.7We still use Postgre SQL 9.3Martin Lind
20.09.20151.0Editorial changes madeImbi Nõgisto
19.10.20151.1Indexes addedMartin Lind
16.12.20161.2Described index added to message logMartin Lind
16.02.20171.3Converted to markdownIlkka Seppälä
16.02.20171.4Added index to logrecord, fixed earlier logrecord index nameOlli Lindgren
02.03.20181.5Added uniform terms and conditions referenceTatu Repo
31.01.20191.6REST supportJarkko Hyöty
11.02.20191.7Added xRequestIdCaro Hautamäki
11.09.20191.8Remove Ubuntu 14.04 supportJarkko Hyöty
06.09.20211.9Update data model due to encryption featuresIlkka Seppälä
26.09.20221.10Remove Ubuntu 18.04 supportAndres Rosenthal
09.01.20251.11Heading level changes for the documentation platformRaido Kaju

Table of Contents

1. General

1.1 Preamble

This document describes database model of X-Road message log.

1.2 Terms and abbreviations

See X-Road terms and abbreviations documentation [TA-TERMS].

1.3 References

  1. [TA-TERMS] X-Road Terms and Abbreviations. Document ID: TA-TERMS.

1.4 Database Version

This database assumes PostgreSQL version 9.2 or later.

1.5 Creating, Backing Up and Restoring the Database

This database is integrated into X-Road message log component.

The database, the database user and the data model is created by the component's installer. The database updates are packaged as component updates and are applied when the component is upgraded. From the technical point of view, the database structure is created and updated using Liquibase tool (see http://www.liquibase.org/). The migration scripts can be found both in component source and in file system of the installed component.

The database is used for logging purposes only and does not contain any configuration. Backing-up and restoring the database is not necessary for the functioning of the component.

1.6 Message Logging and Timestamping

The input to the message log component consists of a message and its corresponding signature (along with hash chain and hash chain result if the signature is a batch signature). Depending on the security policy, timestamping can be asynchronous (one or more signatures are batch timestamped) or synchronous (to guarantee the timestamp).

The process of logging and asynchronous timestamping consists of the following steps:

  1. System verifies that the message and signature can be logged – if the time of last successful timestamping is older than specified by the security policy then no more messages are accepted by the system and the situation should be considered as system failure.
  2. System saves the message and signature in the message log. The message body is stored in encrypted format if the parameter messagelog-encryption-enabled is enabled.
  3. System periodically timestamps messages that have no timestamp. Batch timestamp is created if more than one message is timestamped simultaneously. Regular timestamp is created for single messages.

When timestamping synchronously, the logging call will block until the timestamp is received. The process of synchronous timestamping consists of the following steps:

  1. The system saves the message and signature in the message log.
  2. System timestamps the message synchronously.

1.7 Entity-Relationship Diagram

Entity-Relationship Diagram

2. Description of Entities

2.1 LOGRECORD

Log record can either be a message record or a timestamp record. A message record is created when the system processes an X-Road message. A timestamp record is created when the system timestamps the message records created since the last timestamping. A message record is modified by adding a reference to a timestamp record after it has been timestamped. All the records are modified by changing the archived flag after they have been archived. All the records are eventually deleted after they have been timestamped and archived.

2.1.1 Indexes

NameColumnsPartial index details
logrecordpkidN/A
LOGRECORD_TIMESTAMPRECORD_fkeytimestamprecordN/A
ix_logrecord_groupingmemberclass, membercode, subsystemcode, idWHERE discriminator::text = 'm'::text AND archived = false AND timestamprecord IS NOT NULL
ix_not_archived_logrecordidWHERE discriminator::text = 't'::text AND archived = false
ix_not_timestamped_logrecordid, discriminator, signaturehashWHERE discriminator::text = 'm'::text AND signaturehash IS NOT NULL
LOGRECORD_TIMESTAMPRECORD_fkeytimestamprecordN/A
LOGRECORD_TIMESTAMPRECORD_fkeytimestamprecordN/A
LOGRECORD_TIMESTAMPRECORD_fkeytimestamprecordN/A
IX_NOT_ARCHIVED_LOGRECORDidwhere discriminator = 't' and archived = false
IX_NOT_TIMESTAMPED_LOGRECORDid, discriminator, signaturehashwhere discriminator = 'm' and signaturehash is not null

2.1.2 Attributes

NameTypeModifiersDescription
id [PK]bigintNOT NULLPrimary key
discriminatorcharacter varying(255)NOT NULLTechnical attribute, specifying the Java class to which the log record is mapped. The possible values are “m” (MessageRecord) and “t” (TimestampRecord). The corresponding Java classes are located in the ee.ria.xroad.common.messagelog package.
timebigintThe creation time of the log record (number of milliseconds since January 1, 1970, 00:00:00 GMT).
archivedbooleanA flag indicating whether this log record has been archived.
queryidcharacter varying(255)The id field of the SOAP message header. Only present for message records.
messagetextThe SOAP message body or REST request data. Only present for message records. Created only when encryption is switched off.
signaturetextThe signature of the message. Only present for message records.
hashchaintextIf the signature is a batch signature, the base-64 encoded hash chain. Only present for message records.
hashchainresulttextIf the signature is a batch signature, the base-64 encoded hash chain result. Only present for message records.
signaturehashtextHash of the signature of the message. Only present for message records.
timestamprecord [FK]bigintIdentifies the timestamp record that timestamps this message record. References id attribute of LOGRECORD entity. Only present for message records.
timestamphashchaintextIf the message record is time-stamped, the base-64 encoded hash chain of the timestamp. Only present for message records.
responsebooleanA flag indicating whether the message in this log record is a response message (as opposed to a request message). Only present for message
memberclasscharacter varying(255)Member class of the client who sent this message. Only present for message records.
membercodecharacter varying(255)Member code of the client who sent this message. Only present for message records.
subsystemcodecharacter varying(255)Subsystem code of the client who sent this message. Only present for message records.
attachmentoidThe REST message body (a large binary object)
xrequestidcharacter varying(255)An optional id which is shared between a request and a response.
keyidcharacter varying(255)ID of the key used to encrypt/decrypt the message.
ciphermessagebyteaThe SOAP message body or REST request data in encrypted form. Only present for message records. Created only when encryption is switched on.

2.2 LAST_ARCHIVE_DIGEST

Records the last digest of the archive file. When archiving signatures, the message log links them together using cryptographic hash functions. When creating an archive, the last link is saved in the last_archive_digest table. This makes it possible to continue the hash chain for the next archive file.

The record is created when the first archive file is created. The record is modified every time when an archive file s created. The record is never deleted.

2.2.1 Indexes

NameColumnsPartial index details
last_archive_digestpkidN/A
last_archive_digest_groupname_keygroupnameN/A

2.2.2 Attributes

NameTypeModifiersDescription
id [PK]bigintNOT NULLPrimary key
digesttextDigest of the last archive file.
filenamecharacter varying(255)The filename of the last archive.
groupnamecharacter varying(255)The name of the archive group.

2.3 DATABASECHANGELOG

Liquibase migration of the database. A record is created when the administrator updates the software package containing this database and the database structure needs to be modified. The record is never modified or deleted. This table has a technical nature and is not managed by X-Road application software.

2.3.1 Attributes

NameTypeModifiersDescription
idcharacter varying(255)NOT NULLThe identifier of the migration.
authorcharacter varying(255)NOT NULLThe author of the migration.
filenamecharacter varying(255)NOT NULLThe filename containing the migration script.
dateexecutedtimestamp with time zoneNOT NULLThe time when the migration was executed. Used with orderexecuted to determine rollback order.
orderexecutedintegerNOT NULLThe order number in which the migration was executed. Used in addition to dateexecuted to ensure order is correct even when the databases datetime supports poor resolution.
exectypecharacter varying(10)NOT NULLThe type of the execution that was performed. Possible values are EXECUTED, FAILED, SKIPPED, RERAN, and MARK_RAN.
md5sumcharacter varying(35)The MD5 hash of the migration script when it was executed. Used on each run to ensure there have been no unexpected changes to the migration script.
descriptioncharacter varying(255)Short auto-generated human readable description of the migration.
commentscharacter varying(255)The comments of the migration.
tagcharacter varying(255)The tag of the migration.
liquibasecharacter varying(20)The version of the Liquibase that performed the migration.
contextscharacter varying(255)Context(s) used to execute the changeset.
labelscharacter varying(255)Label(s) used to execute the changeset.
deployment_idcharacter varying(10)Changesets deployed together will have the same unique identifier.

2.4 DATABASECHANGELOGLOCK

Lock used by Liquibase to allow only one migration of the database to run at a time. This table has a technical nature and is not managed by X-Road application software.

2.4.1 Attributes

NameTypeModifiersDescription
id [PK]integerNOT NULLPrimary key. Id of the lock. Currently there is only one lock.
lockedbooleanNOT NULLSet to "1" if the Liquibase is running against this database. Otherwise set to "0".
lockgrantedtimestamp with time zoneDate and time when the lock was granted.
lockedbycharacter varying(255)Human-readable description of who the lock was granted to.