OpenTelemetry Logs

Logs record something that happened at a specific point in time within an application. This page describes how to configure the logging support in OpenTelemetry.

Learn more about logs in the OpenTelemetry documentation.

Enabling/Disabling Logs

Support for OpenTelemetry Logs is enabled by default. You can disable it via configuration properties.

arconia:
  otel:
    logs:
      enabled: false

Configuration Properties

You can configure the support for OpenTelemetry Logs via configuration properties.

Log Limits

Constraints for the data captured by log records.

Table 1. Log Limits Configuration Properties

Property

Default

Description

arconia.otel.logs.limits.max-attribute-value-length

-

The maximum length of an attribute value.

arconia.otel.logs.limits.max-number-of-attributes

128

The maximum number of attributes that can be attached to a log record.

Log Record Processor

Configuration for the batch log record processor.

Table 2. Log Record Processor Configuration Properties

Property

Default

Description

arconia.otel.logs.processor.export-timeout

30s

The maximum allowed time to export log records.

arconia.otel.logs.processor.max-export-batch-size

512

The maximum number of log records to export in a single batch.

arconia.otel.logs.processor.max-queue-size

2048

The maximum number of log records that can be queued before batching.

arconia.otel.logs.processor.metrics

false

Whether to generate metrics for the log record processor.

arconia.otel.logs.processor.schedule-delay

1s

The interval between two consecutive exports.

OpenTelemetry Environment Variables

Arconia supports the OpenTelemetry Environment Variable Specification for configuring the OpenTelemetry integration. If both the OpenTelemetry Environment Variables and the Arconia configuration properties are set, the OpenTelemetry Environment Variables will take precedence.

This support is especially useful during deployment, where you can use the same set of standard environment variables to configure OpenTelemetry Logs across different languages and frameworks.

You can disable this support by setting the arconia.otel.compatibility.environment-variable-specification configuration property to false.

Programmatic Configuration

You can further customize the auto-configured SdkLoggerProvider instance via the OpenTelemetryLoggerProviderBuilderCustomizer API.

@FunctionalInterface
public interface OpenTelemetryLoggerProviderBuilderCustomizer {

    void customize(SdkLoggerProviderBuilder builder);

}

Disabling the Auto-Configuration

The auto-configuration provided by Arconia for OpenTelemetry Logs is enabled by default, but you can disable it as explained in the Enabling/Disabling Logs section.

If you define a custom SdkLoggerProvider bean, the auto-configuration will back off, and your custom bean will be used instead.

@Configuration(proxyBeanMethods = false)
public class MyLoggingConfiguration {

  @Bean
  public SdkLoggerProvider myLoggerProvider() {
    ...
  }

}

Exporting Logs

By default, logs are enabled and exported via OTLP, but you can change the type of exporter globally or specifically for logs. If you set the exporter type to none, the corresponding signal will be disabled from exporting.

If a value is not provided specifically for logs, the value configured for the general exporter is used.
Table 3. General Logs Exporter Configuration Properties

Property

Default

Description

arconia.otel.exporter.type

otlp

The type of OpenTelemetry exporter to use for observability signals. Options: console, otlp, none.

arconia.otel.logs.exporter.type

``

The type of OpenTelemetry exporter to use for logs. Options: console, otlp, none.

For more information on exporting logs to the console, refer to Console Exporter.

OTLP

When logs are exported via OTLP (default behavior), you can configure the following properties.

If a value is not provided specifically for logs, the value configured for the general OTLP export is used, if available. See OTLP.
Table 4. OTLP Logs Exporter Configuration Properties

Property

Default

Description

arconia.otel.logs.exporter.otlp.compression

gzip

Compression type to use for OTLP requests. Options: none, gzip.

arconia.otel.logs.exporter.otlp.connect-timeout

10s

The maximum waiting time for the exporter to establish a connection to the endpoint.

arconia.otel.logs.exporter.otlp.endpoint

http://localhost:4317 (gPRC) or http://localhost:4318/v1/logs (HTTP)

The endpoint to which telemetry data will be sent.

arconia.otel.logs.exporter.otlp.headers

-

Additional headers to include in each request to the endpoint.

arconia.otel.logs.exporter.otlp.metrics

false

Whether to generate metrics for the exporter itself.

arconia.otel.logs.exporter.otlp.protocol

http-protobuf

Transport protocol to use for OTLP requests. Options: grpc, http-protobuf.

arconia.otel.logs.exporter.otlp.timeout

10s

The maximum waiting time for the exporter to send each telemetry batch.

The default OTLP exporter uses HTTP/Protobuf. If you’d like to use gRPC, refer to OTLP gRPC.

SLF4J Bridge

Java applications typically configure logging via SLF4J and use one of the popular implementations such as Logback or Log4J2. Arconia supports bridges to export SLF4J logs to OpenTelemetry.

Logback OpenTelemetry Bridge (from OpenTelemetry Java Instrumentation)

The Arconia OpenTelemetry Spring Boot Starter comes built-in with the Logback OpenTelemetry Bridge provided by the OpenTelemetry Java Instrumentation for Logback Appender, which is based on the OpenTelemetry API and integrates fully with the OpenTelemetry SDK.

The Logback OpenTelemetry Bridge from the OpenTelemetry Java Instrumentation project is still experimental.

Enabling/Disabling the Bridge

The Logback OpenTelemetry Bridge can be disabled via configuration properties.

arconia.otel.logs.logback-bridge.enabled: false

Alternatively, you can exclude the io.arconia:arconia-opentelemetry-logback-bridge dependency from your project, which will disable the bridge entirely.

  • Gradle

  • Maven

dependencies {
    implementation("io.arconia:arconia-opentelemetry-spring-boot-starter") {
        exclude group: "io.arconia", module: "arconia-opentelemetry-logback-bridge"
    }
}
<dependency>
    <groupId>io.arconia</groupId>
    <artifactId>arconia-opentelemetry-spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>io.arconia</groupId>
            <artifactId>arconia-opentelemetry-logback-bridge</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Configuration Properties

The Logback OpenTelemetry Bridge can be configured via configuration properties.

Table 5. Logback OpenTelemetry Bridge Configuration Properties

Property

Default

Description

arconia.otel.logs.logback-bridge.capture-arguments

false

Enable the capture of Logback logger arguments.

arconia.otel.logs.logback-bridge.capture-code-attributes

false

Enable the capture of source code attributes. Note that capturing source code attributes at logging sites might add a performance overhead.

arconia.otel.logs.logback-bridge.capture-experimental-attributes

false

Enable the capture of experimental log attributes thread.name and thread.id.

arconia.otel.logs.logback-bridge.capture-key-value-pair-attributes

false

Enable the capture of Logback key value pairs as attributes.

arconia.otel.logs.logback-bridge.capture-logger-context

false

Enable the capture of Logback logger context properties as attributes.

arconia.otel.logs.logback-bridge.capture-logstash-attributes

false

Enable the capture of Logstash attributes, added to logs via Markers.append(), Markers.appendEntries(), Markers.appendArray() and Markers.appendRaw() methods.

arconia.otel.logs.logback-bridge.capture-marker-attribute

false

Enable the capture of Logback markers as attributes.

arconia.otel.logs.logback-bridge.capture-mdc-attributes

``

Comma separated list of MDC attributes to capture. Use the wildcard character * to capture all attributes.

arconia.otel.logs.logback-bridge.num-logs-captured-before-otel-install

1000

Log telemetry is emitted after the initialization of the OpenTelemetry Logback appender with an OpenTelemetry object. This setting allows you to modify the size of the cache used to replay the first logs. thread.id attribute is not captured.