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.
Property |
Default |
Description |
|
- |
The maximum length of an attribute value. |
|
|
The maximum number of attributes that can be attached to a log record. |
Log Record Processor
Configuration for the batch log record processor.
Property |
Default |
Description |
|
|
The maximum allowed time to export log records. |
|
|
The maximum number of log records to export in a single batch. |
|
|
The maximum number of log records that can be queued before batching. |
|
|
Whether to generate metrics for the log record processor. |
|
|
The interval between two consecutive exports. |
OpenTelemetry Environment Variables
Arconia supports the OpenTelemetry Environment Variable Specification, so you can configure the support for OpenTelemetry Logs using environment variables as well.
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.
OpenTelemetry Java System Properties
Arconia supports the OpenTelemetry Java System Properties in alignment with the OpenTelemetry Java SDK Autoconfigure module. So you can configure the support for OpenTelemetry Logs using system properties as well.
This support is especially useful if you’re migrating from the OpenTelemetry-own Spring Boot Starter to Arconia OpenTelemetry, and you want to minimize the changes in your configuration. Check our migration guide for more information.
When possible, we recommend using the Arconia-specific properties instead of the OpenTelemetry Java system properties since they offer a more consistent configuration experience familiar to Spring Boot users.
Programmatic Configuration
You can further customize the auto-configured SdkLoggerProvider
instance via the SdkLoggerProviderBuilderCustomizer
API.
@FunctionalInterface
public interface SdkLoggerProviderBuilderCustomizer {
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() {
...
}
}
You can also disable the auto-configuration entirely by excluding the io.arconia.opentelemetry.autoconfigure.sdk.logs.OpenTelemetryLoggingAutoConfiguration
class from the Spring Boot auto-configuration:
spring:
autoconfigure:
exclude:
- io.arconia.opentelemetry.autoconfigure.sdk.logs.OpenTelemetryLoggingAutoConfiguration
Exporting Logs
By default, logs are enabled and exported via OTLP, but you can change the type of exporter. If you set the exporter type to none
, the corresponding signal will be disabled from exporting.
Property |
Default |
Description |
|
|
The type of OpenTelemetry exporter to use for logs. Options: |
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. |
Property |
Default |
Description |
|
|
Compression type to use for OTLP requests. Options: |
|
|
The maximum waiting time for the exporter to establish a connection to the endpoint. |
|
|
The endpoint to which telemetry data will be sent. |
|
- |
Additional headers to include in each request to the endpoint. |
|
|
Whether to generate metrics for the exporter itself. |
|
|
Transport protocol to use for OTLP requests. Options: |
|
|
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. |
Logback Appender Bridge
Java applications typically configure logging via SLF4J and use one of the popular implementations such as Logback or Log4J2. The Arconia OpenTelemetry Spring Boot Starter provides a bridge that allows you to convert log events generated by Logback to OpenTelemetry Logs and export them via OTLP.
Enabling/Disabling the Bridge
The bridge logic is provided by the OpenTelemetry Java Instrumentation for Logback Appender and can be disabled selectively via configuration properties.
arconia:
otel:
instrumentation:
logback-appender:
enabled: false
Note: Refer to the Instrumentation section for more information on how Arconia integrates the OpenTelemetry Java Instrumentation.
Configuration Properties
The Logback Appender Bridge can be configured via configuration properties.
Property |
Default |
Description |
|
|
Enable the capture of Logback logger arguments. |
|
|
Enable the capture of source code attributes. Note that capturing source code attributes at logging sites might add a performance overhead. |
|
|
Enable the capture of experimental log attributes |
|
|
Enable the capture of Logback key value pairs as attributes. |
|
|
Enable the capture of Logback logger context properties as attributes. |
|
|
Enable the capture of Logstash attributes, added to logs via |
|
|
Enable the capture of Logback markers as attributes. |
|
`` |
Comma separated list of MDC attributes to capture. Use the wildcard character |
|
|
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. |