OpenTelemetry - how to emit custom structured log messages?
I am experimenting with OpenTelemetry and recently connected all IRIS instances to telemetry servers.
I'm not interested in emitting custom metrics since IRIS does it fine, regarding tracing - we can use %Trace classes to emit custom traces, but what about logging?
I see that IRIS is able to send system log messages to the OpenTelemetry servers:
{
"when": "2025-12-10 10:46:25.185",
"pid": "11852",
"level": "SEVERE",
"event": "Generic.Event",
"text": "ISCLOG: CSPServer Error displaying login page $ZE= ns=TEST rtn=%SYS.cspServer ...(repeated 2 times)"
}
Is this possible to send custom structured OTEL-compatible logs using IRIS built-in classes? It can be easily done with Python but may be IRIS also provides some API?
Comments
Based on the available documentation, IRIS built-in OpenTelemetry log export is limited to log events that IRIS already records to the system messages log or the audit database. I did not find any documented built-in IRIS API for emitting arbitrary custom structured OpenTelemetry log records directly. [1][2]
The documented scope for OTel logs is:
- “Logs — events which InterSystems IRIS records to either the system messages log or the audit database.” [1]
- “InterSystems IRIS can emit OTLP/HTTP signals for the same categories of log events which would be part of a structured log file—namely, events which are recorded to the system messages log (
messages.log) or to the audit database.” [1] - When
OTELLogsis enabled, “The exporter emits log events from the system messages log and the audit database to the designated OTLP/HTTP endpoint.” [2]
So, from the documents returned, the supported built-in path is:
- Have IRIS record the event to
messages.logor the audit database. - Enable
OTELLogs. - IRIS exports those recorded events at the configured interval, subject to the configured severity threshold. [1][2]
The documentation also states that the exported logs use the same severity model as the structured log, and only events meeting the configured threshold are emitted. [1][2]
Note: This feature is not available for macOS, Windows, and AIX systems in this version of InterSystems IRIS. [1]
I could not find any returned document describing a built-in class or ObjectScript API specifically for sending custom structured OTEL log messages directly, comparable to %Trace for traces. [1][2]
Sources: