Monitoring

This page describes logging and observability of In-App Protection components. For the full list of environment variables see Configuration Properties.

Logging

By default, every application logs to the console in a text format that includes structured kv(...) fields (for example action or state), rendered by the %sa conversion word:

%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%sa%n%ex

When using the default logback-spring.xml, the pattern can be changed using the standard Spring Boot property logging.pattern.console. The dev profile instead selects logback-dev.xml, which uses a fixed pattern and does not read this property.

Warning: a custom logging.pattern.console that does not contain %sa silently drops all kv(...) structured data from the log output. Keep %msg%sa in the custom pattern.

JSON Logging

JSON logging (LogstashEncoder) is an explicit opt-in. The Docker images ship the JSON configuration in /opt/logback/conf/logback.xml; enable it by pointing Spring Boot at it:

LOGGING_CONFIG=/opt/logback/conf/logback.xml

When logging.config is set, the default text configuration and logging.pattern.console are not used.

OpenTelemetry Java Agent

When the OpenTelemetry Java agent (-javaagent) is attached to a component, structured log fields written with kv(...) (for example action or state) are not exported by default, even if the console log shows them. Only the formatted message, the log level and the resource attributes reach the observability backend.

To export the fields as log attributes, set the following standard agent variable on the same process:

Environment Variable Default Value Description
OTEL_INSTRUMENTATION_COMMON_LOGGING_STRUCTURED_ATTRIBUTES_INCLUDED   Comma-separated glob patterns of structured log field keys to export, e.g. * or action,state
OTEL_INSTRUMENTATION_COMMON_LOGGING_STRUCTURED_ATTRIBUTES_EXCLUDED   Comma-separated glob patterns of keys never exported; takes precedence over the included patterns, e.g. request

Note: * exports every kv(...) value, including values that may contain sensitive data. Restrict the list in environments where this is a concern.

The setting works with both the text (%msg%sa%n) and the JSON (LogstashEncoder) logging configurations. In Elastic APM the exported fields are stored as labels.<key>, e.g. labels.action.

Last updated on Nov 16, 2026 (21:44) View product

develop

In-App Protection