7.4. Logs
Observability Framework stores the log messages generated by Connext applications in third-party backends (for example, Grafana Loki).
When a Connext application starts, it may generate log messages before Monitoring Library 2.0 is loaded and enabled. Any such log messages are not stored by Observability Framework.
Each log message is divided into six parts to facilitate analysis, as illustrated in Table 7.22.
Component |
Description |
Example |
Always present |
---|---|---|---|
Timestamp |
The time the log message was generated. |
|
Yes |
Syslog Facility |
The facility (MIDDLEWARE, SECURITY_EVENT, SERVICE, or USER) and the sequence number of the log message for the facility. |
|
Yes |
Syslog Level |
The severity (EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFORMATIONAL, or DEBUG). |
|
Yes |
Activity Context |
The DDS context in which the log was generated. See Activity Context. |
|
No |
Message |
The message contents. |
|
Yes |
7.4.1. Syslog Levels and Facilities
All the log messages generated by the Connext applications are members of a Syslog facility. Syslog facilities are numerical codes that represent the source of the log message, allowing the system or network administrator to categorize and filter log messages based on their origin. These facilities help organize log data, making it easier to manage and analyze.
This release supports the following Syslog facilities:
MIDDLEWARE (23): Messages generated by the Connext middleware.
SECURITY_EVENT (10): Security-related messages generated by the Security Plugins Logging Plugin.
SERVICE (22): Messages generated by infrastructure services, such as Routing Service.
USER (1): Messages generated by the Connext logger APIs that log user messages.
The Syslog facility is always present in the log message, and it is followed by a sequence number that uniquely identifies the log message within the facility. The sequence number is useful for tracking the order of log messages within the same facility and for identifying missing log messages.
The available Syslog levels are: EMERGENCY, CRITICAL, ALERT, ERROR, WARNING, NOTICE, INFORMATIONAL, or DEBUG.
For SECURITY_EVENT and USER facilities, you can get messages with any Syslog level. However, for the other facilities (MIDDLEWARE and SERVICE), the Syslog level of the message is determined by translating the Connext builtin logging level associated with the message to the Syslog level.
The mapping between Connext’s builtin logging levels (NDDS_Config_LogLevel) and Syslog Levels (NDDS_Config_SysLogLevel) is as follows:
NDDS_Config_LogLevel |
Syslog Level |
Minimum Syslog Verbosity that lets the message pass through |
---|---|---|
NDDS_CONFIG_LOG_LEVEL_FATAL_ERROR |
EMERGENCY (1) |
ERROR |
NDDS_CONFIG_LOG_LEVEL_ERROR |
ERROR (15) |
ERROR |
NDDS_CONFIG_LOG_LEVEL_WARNING |
WARNING (31) |
WARNING |
NDDS_CONFIG_LOG_LEVEL_STATUS_LOCAL |
INFORMATIONAL (127) |
INFORMATIONAL |
NDDS_CONFIG_LOG_LEVEL_STATUS_REMOTE |
INFORMATIONAL (127) |
INFORMATIONAL |
NDDS_CONFIG_LOG_LEVEL_DEBUG |
DEBUG (255) |
DEBUG |
For additional information on Syslog levels and facilities, see Configuring Connext Logging in the RTI Connext Core Libraries User’s Manual.
7.4.2. Activity Context
The Activity Context provides context for the log message associated with it. The information provided by the Activity Context includes a sequence of activities and resources to which the activities apply. Comparing the Activity Context to traces and spans in OpenTelemetry, you can think of the Activity Context as a trace and the individual activities within the Activity Context as spans within the trace. For additional information on the Activity Context, see Format of Logged Messages in the RTI Connext Core Libraries User’s Manual.
The Activity Context is available by default in all log messages generated by a Connext application. However, you can disable this information by using the APIs in the C language binding: see NDDS_Config_Logger_set_print_format and NDDS_Config_Logger_set_print_format_by_log_level. The same APIs are available in other language bindings.
7.4.3. Log Labels
As with metrics, logs also have an associated set of labels. In Grafana Loki, labels are key/value pairs that act as metadata to describe a log stream. The combination of every label key and value defines a log stream. If just one label value changes, this creates a new stream. Refer to the official Grafana Loki documentation for further details about labels.
Table 7.24 describes the log labels generated by Connext applications.
Loki Label Name |
Description |
---|---|
|
The source of the log message. This label is useful when multiple system resources share the same Loki
instance. For Connext applications, the |
|
A GUID that identifies the specific Connext application that generated the log message. |
|
The logging category of the message.
If the logging category is not available for a log message of any
facility, its value is |
|
Only for messages with SECURITY_EVENT facility. The standard plugin class name that originated the message, as defined in the OMG ‘DDS Security’ specification, version 1.2. Here, the |
Standard plugin class names |
Associated category |
---|---|
|
|
|
|
|
|
|
|
|
|
Following are a few examples of how you could use log labels in Grafana Loki:
Use the
resource_guid
label to query all the log messages generated by a specific Connext application.Use the
category
label to query all the log messages related to discovery.Use the
plugin_class
label to query all the log messages related to authentication logged by the Security Plugins (RTI:Auth
plugin class).
7.4.4. Collection and Forwarding Verbosity
Monitoring Library 2.0 has two verbosity settings:
Collection verbosity controls the level of log messages an application generates.
Forwarding verbosity controls the level of log messages an application forwards to the Observability Collector Service (making the messages visible in the dashboard).
By default, Monitoring Library 2.0 only forwards error and warning log messages, even if the applications generate more verbose logging. Forwarding messages at a higher verbosity for all applications may saturate the network and the different Observability Framework components, such as Observability Collector Service and the logging aggregation backend (for example, Grafana Loki).
Both the collection and forwarding verbosity can be set locally by changing the configuration of a Connext application or remotely by sending a command.
7.4.4.1. Changing Verbosity Levels Locally
The collection level can be changed locally using the
NDDS_Config_Logger_set_verbosity_by_category
and NDDS_Config_Logger_set_verbosity
APIs for C or equivalent in other languages. You can also use the
logging
XML tag under participant_factory_qos
.
The collection level can be changed at any time.
The forwarding level can be changed per facility using the
participant_factory_qos.monitoring.telemetry_data.logs.<facility>_forwarding_level
field in the MONITORING QosPolicy (DDS Extension).
This QoS policy can be configured programmatically or via XML.
When set programmatically using QoS, the forwarding level must be changed
before the Monitoring Library 2.0 is enabled.
7.4.4.2. Changing Verbosity Levels Remotely
The collection and forwarding levels can both be changed remotely. There are two methods available to send remote commands:
Using Observability Dashboards, as described in Change the Application Logging Verbosity
Using the Collector Service REST API as described in the Collector Service REST API Reference.
The Observability Dashboards only allow setting the following Syslog levels: ERROR, WARNING, INFORMATIONAL, and DEBUG. The Collector Service REST API allows you to set all the Syslog levels.