Configuration referenceedit

api_keyedit

Environment variable name Option name in php.ini

ELASTIC_APM_API_KEY

elastic_apm.api_key

Default Type

None

String

This string is used to ensure that only your agents can send data to your APM Server. You must have created the API key using the APM Server’s command line tool.

api_key is an alternative to secret_token. If both secret_token and api_key are configured then api_key has precedence and secret_token is ignored.

This feature is fully supported in the APM Server versions >= 7.6.

The api_key value is sent as plain-text in every request to the server, so you should also secure your communications using HTTPS. Unless you do so, your API Key could be observed by an attacker.

enablededit

Environment variable name Option name in php.ini

ELASTIC_APM_ENABLED

elastic_apm.enabled

Default Type

false

Boolean

Setting to false will completely disable the agent.

environmentedit

Environment variable name Option name in php.ini

ELASTIC_APM_ENVIRONMENT

elastic_apm.environment

Default Type

None

String

The name of the environment this service is deployed in, e.g. "production" or "staging".

Environments allow you to easily filter data on a global level in the APM app. It’s important to be consistent when naming environments across agents. See environment selector in the Kibana UI for more information.

This feature is fully supported in the APM app in Kibana versions >= 7.2. You must use the query bar to filter for a specific environment in versions prior to 7.2.

log_leveledit

Environment variable name Option name in php.ini

ELASTIC_APM_LOG_LEVEL

elastic_apm.log_level

Default Type

None

Log level

Fallback configuration setting to control the logging level for the agent. This setting has effect for the sink when sink specific option is not set explicitly. See Logging for details.

log_level_stderredit

Environment variable name Option name in php.ini

ELASTIC_APM_LOG_LEVEL_STDERR

elastic_apm.log_level_stderr

Default Type

CRITICAL

Log level

The logging level for stderr logging sink. See Logging for details.

log_level_syslogedit

Environment variable name Option name in php.ini

ELASTIC_APM_LOG_LEVEL_SYSLOG

elastic_apm.log_level_syslog

Default Type

INFO

Log level

The logging level for syslog logging sink. See Logging for details.

secret_tokenedit

Environment variable name Option name in php.ini

ELASTIC_APM_SECRET_TOKEN

elastic_apm.secret_token

Default Type

None

String

This string is used to ensure that only your agents can send data to your APM Server. Both the agents and the APM Server have to be configured with the same secret token.

See the relevant APM Server’s documentation on how to configure APM Server’s secret token.

Use this setting if the APM Server requires a token, like in Elasticsearch Service.

secret_token is an alternative to api_key. If both secret_token and api_key are configured then api_key has precedence and secret_token is ignored.

The secret_token is sent as plain-text in every request to the server, so you should also secure your communications using HTTPS. Unless you do so, your secret token could be observed by an attacker.

server_timeoutedit

Environment variable name Option name in php.ini

ELASTIC_APM_SERVER_TIMEOUT

elastic_apm.server_timeout

Default Type

30s

Duration

If a request sending events to the APM server takes longer than the configured timeout, the request is canceled, and the events are discarded.

This configuration option supports the duration suffixes: ms, s and m. For example: 10s. This option’s default unit is s, so 5 is interpreted as 5s.

If the value is 0 (or 0ms, 0s, etc.) the timeout for sending events to the APM Server is disabled.

If the value is negative, it’s invalid, and the default value is used instead.

server_urledit

Environment variable name Option name in php.ini

ELASTIC_APM_SERVER_URL

elastic_apm.server_url

Default Type

http://localhost:8200

String

The URL for your APM Server. The URL must be fully qualified, including protocol (http or https) and port.

service_nameedit

Environment variable name Option name in php.ini

ELASTIC_APM_SERVICE_NAME

elastic_apm.service_name

Default Type

Unnamed PHP service

String

This is used to keep all the errors and transactions of your service together and it is the primary filter in the Elastic APM user interface.

The service name must conform to this regular expression: ^[a-zA-Z0-9 _-]+$. In less regexy terms: your service name must only contain characters from the ASCII alphabet, numbers, dashes, underscores and spaces. Characters in service name which don’t match regular expression will be replaced by _ (underscore) character.

service_versionedit

Environment variable name Option name in php.ini

ELASTIC_APM_SERVICE_VERSION

elastic_apm.service_version

Default Type

None

String

The version of the currently deployed service. If you don’t version your deployments, the recommended value for this field is the commit identifier of the deployed revision, e.g., the output of git rev-parse HEAD.

transaction_max_spansedit

Environment variable name Option name in php.ini

ELASTIC_APM_TRANSACTION_MAX_SPANS

elastic_apm.transaction_max_spans

Default Type

500

Integer

Limits the amount of spans that are recorded per transaction. This is helpful in cases where a transaction creates a very high amount of spans, for example, thousands of SQL queries. Setting an upper limit helps prevent overloading the Agent and APM server in these edge cases.

If the value is 0 no spans will be collected.

If the value is negative, it’s invalid, and the default value is used instead.

transaction_sample_rateedit

Environment variable name Option name in php.ini

ELASTIC_APM_TRANSACTION_SAMPLE_RATE

elastic_apm.transaction_sample_rate

Default Type

1.0

Floating-point number

By default, the agent will sample every transaction (e.g., a request to your service). To reduce overhead and storage requirements, you can set the sample rate to a value between 0.0 and 1.0. The agent will still record the overall time and result for unsampled transactions, but not context information, labels, or spans.

verify_server_certedit

Environment variable name Option name in php.ini

ELASTIC_APM_VERIFY_SERVER_CERT

elastic_apm.verify_server_cert

Default Type

true

Boolean

By default, the agent verifies the SSL certificate if you use an HTTPS connection to the APM server. The verification can be disabled by changing this setting to false.