Secret token
editSecret token
editSecret tokens are sent as plain-text, so they only provide security when used in combination with TLS.
When defined, secret tokens are used to authorize requests to the APM Server. Both the APM agent and APM Server must be configured with the same secret token for the request to be accepted.
To secure the communication between APM agents and the APM Server with a secret token:
- Make sure TLS is enabled
- Create a secret token
- Configure the secret token in your APM agents
Secret tokens are not applicable for the RUM Agent, as there is no way to prevent them from being publicly exposed.
Elasticsearch Service and Elastic Cloud Enterprise deployments provision a secret token when the deployment is created. The secret token can be found and reset in the Elastic Cloud console under Deployments — APM & Fleet.
Create or update a secret token in Fleet.
Configure and customize Fleet-managed APM settings directly in Kibana:
- Open Kibana and navigate to Fleet.
- Under the Agent policies tab, select the policy you would like to configure.
- Find the Elastic APM integration and select Actions > Edit integration.
- Navigate to Agent authorization > Secret token and set the value of your token.
- Click Save integration. The APM Server will restart before the change takes effect.
Set the secret token in apm-server.yaml
:
apm-server.auth.secret_token: <secret-token>
Each Elastic APM agent has a configuration option to set the value of the secret token:
-
Android agent:
secretToken
-
Go agent:
ELASTIC_APM_SECRET_TOKEN
-
iOS agent:
secretToken
-
Java agent:
secret_token
-
.NET agent:
ELASTIC_APM_SECRET_TOKEN
-
Node.js agent:
Secret Token
-
PHP agent:
secret_token
-
Python agent:
secret_token
-
Ruby agent:
secret_token
In addition to setting the secret token, ensure the configured server URL uses HTTPS
instead of HTTP
:
-
Go agent:
ELASTIC_APM_SERVER_URL
-
Java agent:
server_urls
-
.NET agent:
ServerUrl
-
Node.js agent:
serverUrl
-
PHP agent:
server_url
-
Python agent:
server_url
-
Ruby agent:
server_url