Movatterモバイル変換


[0]ホーム

URL:


Loading
  1. Elastic Docs/
  2. Reference/
  3. Ingestion tools/
  4. APM/
  5. APM agents/
  6. APM Java agent/
  7. Configuration

Logging configuration options

Sets the logging level for the agent. This option is case-insensitive.

Note

CRITICAL is a valid option, but it is mapped toERROR;WARN andWARNING are equivalent;OFF is only available since version 1.16.0

dynamic config

Valid options:OFF,ERROR,CRITICAL,WARN,WARNING,INFO,DEBUG,TRACE

DefaultTypeDynamic
INFOLogLeveltrue
Java System PropertiesProperty fileEnvironment
elastic.apm.log_levellog_levelELASTIC_APM_LOG_LEVEL

Sets the path of the agent logs. The special value_AGENT_HOME_ is a placeholder for the folder the elastic-apm-agent.jar is in. Example:_AGENT_HOME_/logs/elastic-apm.log

When set to the special valueSystem.out, the logs are sent to standard out.

Note

When logging to a file, the log will be formatted in new-line-delimited JSON. When logging to std out, the log will be formatted as plain-text.

DefaultTypeDynamic
System.outStringfalse
Java System PropertiesProperty fileEnvironment
elastic.apm.log_filelog_fileELASTIC_APM_LOG_FILE

Specifying whether and how the agent should automatically reformat application logs intoECS-compatible JSON, suitable for ingestion into Elasticsearch for further Log analysis. This functionality is available for log4j1, log4j2, Logback andjava.util.logging. The ECS log lines will include active trace/transaction/error IDs, if there are such.

This option only applies to pattern layouts/formatters by default. See alsolog_ecs_formatter_allow_list. To properly ingest and parse ECS JSON logs, follow thegetting started guide.

Available options:

  • OFF - application logs are not reformatted.
  • SHADE - agent logs are reformatted and "shade" ECS-JSON-formatted logs are automatically created in addition to the original application logs. Shade logs will have the same name as the original logs, but with the ".ecs.json" extension instead of the original extension. Destination directory for the shade logs can be configured through thelog_ecs_reformatting_dir configuration. Shade logs do not inherit file-rollover strategy from the original logs. Instead, they use their own size-based rollover strategy according to thelog_file_size configuration and while allowing maximum of two shade log files.
  • REPLACE - similar toSHADE, but the original logs will not be written. This option is useful if you wish to maintain similar logging-related overhead, but write logs to a different location and/or with a different file extension.
  • OVERRIDE - same log output is used, but in ECS-compatible JSON format instead of the original format.
Note

whileSHADE andREPLACE options are only relevant to file log appenders, theOVERRIDE option is also valid for other appenders, like System out and console.

dynamic config

Valid options:OFF,SHADE,REPLACE,OVERRIDE

DefaultTypeDynamic
OFFLogEcsReformattingtrue
Java System PropertiesProperty fileEnvironment
elastic.apm.log_ecs_reformattinglog_ecs_reformattingELASTIC_APM_LOG_ECS_REFORMATTING

A comma-separated list of key-value pairs that will be added as additional fields to all log events. Takes the formatkey=value[,key=value[,...]], for example:key1=value1,key2=value2. Only relevant iflog_ecs_reformatting is set to any option other thanOFF. Additional fields are currently not supported for direct log sending through the agent.

DefaultTypeDynamic
<none>Mapfalse
Java System PropertiesProperty fileEnvironment
elastic.apm.log_ecs_reformatting_additional_fieldslog_ecs_reformatting_additional_fieldsELASTIC_APM_LOG_ECS_REFORMATTING_ADDITIONAL_FIELDS

Only formatters that match an item on this list will be automatically reformatted to ECS whenlog_ecs_reformatting is set to any option other thanOFF. A formatter is the logging-framework-specific entity that is responsible for the formatting of log events. For example, in log4j it would be aLayout implementation, whereas in Logback it would be anEncoder implementation.

This option supports the wildcard*, which matches zero or more characters. Examples:/foo/*/bar/*/baz*,*foo*. Matching is case insensitive by default. Prepending an element with(?-i) makes the matching case sensitive.

DefaultTypeDynamic
*PatternLayout*, org.apache.log4j.SimpleLayout, ch.qos.logback.core.encoder.EchoEncoder, java.util.logging.SimpleFormatter, org.apache.juli.OneLineFormatter, org.springframework.boot.logging.java.SimpleFormatterListfalse
Java System PropertiesProperty fileEnvironment
elastic.apm.log_ecs_formatter_allow_listlog_ecs_formatter_allow_listELASTIC_APM_LOG_ECS_FORMATTER_ALLOW_LIST

Iflog_ecs_reformatting is set toSHADE orREPLACE, the shade log files will be written alongside the original logs in the same directory by default. Use this configuration in order to write the shade logs into an alternative destination. Omitting this config or setting it to an empty string will restore the default behavior. If relative path is used, this path will be used relative to the original logs directory.

DefaultTypeDynamic
<none>Stringfalse
Java System PropertiesProperty fileEnvironment
elastic.apm.log_ecs_reformatting_dirlog_ecs_reformatting_dirELASTIC_APM_LOG_ECS_REFORMATTING_DIR

The size of the log file.

The agent always keeps one history file so that the max total log file size is twice the value of this setting.

DefaultTypeDynamic
50mbByteValuefalse
Java System PropertiesProperty fileEnvironment
elastic.apm.log_file_sizelog_file_sizeELASTIC_APM_LOG_FILE_SIZE

Defines the log format when logging toSystem.out.

When set toJSON, the agent will format the logs in anECS-compliant JSON format where each log event is serialized as a single line.

Valid options:PLAIN_TEXT,JSON

DefaultTypeDynamic
PLAIN_TEXTLogFormatfalse
Java System PropertiesProperty fileEnvironment
elastic.apm.log_format_soutlog_format_soutELASTIC_APM_LOG_FORMAT_SOUT

Defines the log format when logging to a file.

When set toJSON, the agent will format the logs in anECS-compliant JSON format where each log event is serialized as a single line.

Valid options:PLAIN_TEXT,JSON

DefaultTypeDynamic
PLAIN_TEXTLogFormatfalse
Java System PropertiesProperty fileEnvironment
elastic.apm.log_format_filelog_format_fileELASTIC_APM_LOG_FORMAT_FILE

Sends agent and application logs directly to APM Server.

Note that logs can get lost if the agent can’t keep up with the logs, if APM Server is not available, or if Elasticsearch can’t index the logs fast enough.

For better delivery guarantees, it’s recommended to ship ECS JSON log files with Filebeat See alsolog_ecs_reformatting. Log sending does not currently support custom MDC fields,log_ecs_reformatting and shipping the logs with Filebeat must be used if custom MDC fields are required.

dynamic config

DefaultTypeDynamic
falseBooleantrue
Java System PropertiesProperty fileEnvironment
elastic.apm.log_sendinglog_sendingELASTIC_APM_LOG_SENDING

[8]ページ先頭

©2009-2026 Movatter.jp