Skip to main content

Message Broker Logs

Overview​

The Message Broker Logs feature enables logging of messages exchanged between applications via the message broker.

Once enabled, the system immediately starts recording all messages passing through the broker without requiring a restart.


Enabling Logging​

To enable message logging:

  1. Open Server Configuration Tool
  2. Locate the setting: Store broker logs
  3. Set the toggle to ON

Logging will start immediately after enabling the option.


Data Storage​

  • Logs are stored in the same database as standard system logs
  • A dedicated table is used: MessageBrokerLogEntry

Logged Data​

Each log entry contains:

  • Full message payload sent through the message broker
  • A field: direction indicating message flow:
    • 1 – message received from the queue (IN)
    • 0 – message sent to the queue (OUT)

Clearing Logs​

Logs can be manually removed using the Server Configuration Tool:

  1. Open Server Configuration Tool
  2. Click: Clear Broker Logs
  3. This operation removes all entries from the MessageBrokerLogEntry table.

Data Retention​

The system automatically limits the number of stored log entries:

  • Default maximum number of messages: 1,000
  • Retention policy:
    • Runs every hour
    • Removes the oldest entries
    • Keeps only the most recent 1,000 records

Reason for Limitation​

This limit is intentionally conservative to prevent issues with database storage in environments where database configuration has not been optimized.

Some database engines may fail to store large volumes of log data without additional administrative configuration. For example, in Microsoft SQL Server, the following error may occur: SqlException (0x80131904): Could not allocate space for object 'pct-logging-server.LogEntries'.'PK_LogEntries' in database 'logs' because the 'PRIMARY' filegroup is full. In such cases, database-level changes (e.g., increasing file size or enabling auto-growth) are required.

Customizing the Limit​

The retention limit can be modified in the application configuration file:

  • File: appsettings.json (located in the logging-server installation directory)
  • Setting: MaxBrokerMessagesToRetain

Example:

{
...
"MaxBrokerMessagesToRetain": 5000
...
}

In Kubernetes deployments, the same setting can be configured using an environment variable:

  • Environment variable: PCTLOGGER_LogsRetention__MaxBrokerMessageToRetain

After changing this value, the system will retain up to the specified number of most recent log entries.

Important Notes​

Increasing this value may significantly impact database size and performance Ensure that your database is properly configured (storage, auto-growth, monitoring) before raising the limit


Notes​

  • Enabling this feature may increase database size and impact performance under high message throughput
  • Recommended usage:
    • troubleshooting
    • debugging inter-application communication