Configuration optionsedit

The available configuration options and equivalent environment variable names are listed below.

For more information on setting configuration options, including configuration precedence, see configuring the agent.

The only required parameter is serviceName. However, the agent will use the name from package.json by default if available.

serviceNameedit

  • Type: String
  • Default: name field of package.json
  • Env: ELASTIC_APM_SERVICE_NAME

Your Elastic APM service name.

Allowed characters: a-z, A-Z, 0-9, -, _, and space.

serviceNodeNameedit

  • Type: String
  • Env: ELASTIC_APM_SERVICE_NODE_NAME

A unique name for the service node. This is optional, and if omitted, the APM Server will fall back on system.container.id if available, and finally host.name if necessary.

This option allows you to set the node name manually to ensure uniqueness and meaningfulness.

secretTokenedit

  • Type: String
  • Env: ELASTIC_APM_SECRET_TOKEN

The secret token optionally expected by the APM Server.

apiKeyedit

  • Type: String
  • Env: ELASTIC_APM_API_KEY

The API key optionally expected by the APM Server. This is an alternative to secretToken.

This base64-encoded 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 command line tool. Please see the APM server documentation for details on how to do that.

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

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

serverUrledit

  • Type: String
  • Default: http://localhost:8200
  • Env: ELASTIC_APM_SERVER_URL

The URL to where the APM Server is deployed.

verifyServerCertedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_VERIFY_SERVER_CERT

By default the agent will validate the TLS/SSL certificate of the APM Server if using HTTPS. You can switch this behavior off by setting this option to false.

serverCaCertFileedit

  • Type: String
  • Env: ELASTIC_APM_SERVER_CA_CERT_FILE

By default the agent will validate the TLS/SSL certificate of the APM Server using the well-known CAs curated by Mozilla, as described in the Node.js docs for tls.createSecureContext(). You can set this option to the path of a file containing a CA certificate that will be used instead.

Specifying this option is required when using self-signed certificates, unless server certificate validation is disabled.

serviceVersionedit

  • Type: String
  • Default: version field of package.json
  • Env: ELASTIC_APM_SERVICE_VERSION

The version of the app currently running. This could be the version from your package.json file, a git commit reference, or any other string that might help you pinpoint a specific version or deployment.

activeedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_ACTIVE

A boolean specifying if the agent should be active or not. If active, the agent will instrument incoming HTTP requests and track errors. Normally you would not want to run the agent in your development or testing environments. If you are using the NODE_ENV environment variable, you can use this to determine the state:

var options = {
  active: process.env.NODE_ENV === 'production'
}

environmentedit

  • Type: String
  • Default: process.env.NODE_ENV || 'development'
  • Env: ELASTIC_APM_ENVIRONMENT

The environment name is automatically logged along with all errors and transactions. If you want to overwrite this, use this option.

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 APM app 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.

disableSendedit

  • Type: Boolean
  • Default: false
  • Env: ELASTIC_APM_DISABLE_SEND

If set to true, the agent will work as usual, except for any task requiring communication with the APM server. Events will be dropped and the agent won’t be able to receive central configuration, which means that any other configuration cannot be changed in this state without restarting the service. Example uses for this setting are: maintaining the ability to create traces and log trace/transaction/span IDs through the log correlation feature, and getting automatic distributed tracing via the W3C HTTP headers.

instrumentedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_INSTRUMENT

A boolean specifying if the agent should automatically apply instrumentation to supported modules when they are loaded.

Note that both active and instrument needs to be true for instrumentation to be running.

instrumentIncomingHTTPRequestsedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_INSTRUMENT_INCOMING_HTTP_REQUESTS

A boolean specifying if the agent should instrument incoming HTTP requests.

To configure if outgoing http requests should be instrumented, see disableInstrumentations.

centralConfigedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_CENTRAL_CONFIG

Activate APM Agent Configuration via Kibana. If set to true, the client will poll the APM Server regularly for new agent configuration.

This feature requires APM Server v7.3 or later and that the APM Server is configured with kibana.enabled: true. More information is available in APM Agent configuration.

asyncHooksedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_ASYNC_HOOKS

A boolean specifying if the agent should use the experimental Async Hooks API found in Node.js version 8.2.0 and above. This setting has no effect when running a Node.js version older than 8.2.0.

If you experience any issues related to using Async Hooks, please open an issue.

Note that not all core Node.js API’s can be instrumented without the use of Async Hooks if running Node.js 8 or above.

transactionIgnoreUrlsedit

  • Type: Array
  • Default: []
  • Env: ELASTIC_APM_TRANSACTION_IGNORE_URLS
  • dynamic config Central config name: transaction_ignore_urls

Array or comma-separated string used to restrict requests for certain URLs from being instrumented.

When an incoming HTTP request is detected, its URL pathname will be tested against each string in this list. The transactionIgnoreUrls property supports exact string matches, simple wildcard (*) matches, and may not include commas. Wildcard matches are case-insensitive by default. You may make wildcard searches case-sensitive by using the (?-i) prefix.

Note that all errors that are captured during a request to an ignored URL are still sent to the APM Server regardless of this setting.

If you need full regular expression pattern matching, see ignoreUrls.

Example usage:

require('elastic-apm-node').start({
  transactionIgnoreUrls: [
    '/ping',
    '/fetch/*',
    '(?-i)/caseSensitiveSearch'
  ]
})

ignoreUrlsedit

  • Type: Array
  • Default: undefined

Used to restrict requests to certain URLs from being instrumented.

This property should be set to an array containing one or more strings or RegExp objects. When an incoming HTTP request is detected, its URL will be tested against each element in this list. If an element in the array is a String, an exact match will be performed. If an element in the array is a RegExp object, its test function will be called with the URL being tested.

Note that all errors that are captured during a request to an ignored URL are still sent to the APM Server regardless of this setting.

If you’d prefer simple wildcard pattern matching, see transactionIgnoreUrls.

Example usage:

require('elastic-apm-node').start({
  ignoreUrls: [
    '/ping',
    /^\/admin\//i
  ]
})

ignoreUserAgentsedit

  • Type: Array
  • Default: undefined

Used to restrict requests from certain User-Agents from being instrumented.

This property should be set to an array containing one or more strings or RegExp objects. When an incoming HTTP request is detected, the User-Agent from the request headers will be tested against each element in this list. If an element in the array is a String, it’s matched against the beginning of the User-Agent. If an element in the array is a RegExp object, its test function will be called with the User-Agent string being tested.

Note that all errors that are captured during a request by an ignored user agent are still sent to the APM Server regardless of this setting.

Example usage:

require('elastic-apm-node').start({
  ignoreUserAgents: [
    'curl/',
    /pingdom/i
  ]
})

captureBodyedit

  • Type: String
  • Default: off
  • Env: ELASTIC_APM_CAPTURE_BODY
  • dynamic config Central config name: capture_body

The HTTP body of incoming HTTP requests is not recorded and sent to the APM Server by default.

Possible options are: off, all, errors, and transactions.

  • off - request bodies will never be reported
  • errors - request bodies will only be reported with errors
  • transactions - request bodies will only be reported with request transactions
  • all - request bodies will be reported with both errors and request transactions

The recorded body will be truncated if larger than 2 KiB.

If the body parsing middleware captures the body as raw Buffer data, the request body will be represented as the string "<Buffer>".

For the agent to be able to access the body, the body needs to be available as a property on the incoming HTTP request object. The agent will look for the body on the following properties: req.json || req.body || req.payload

captureHeadersedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_CAPTURE_HEADERS

The HTTP headers of incoming HTTP requests, and its resulting response headers, are recorded and sent to the APM Server by default. This can be disabled by setting this option to false.

errorOnAbortedRequestsedit

  • Type: Boolean
  • Default: false
  • Env: ELASTIC_APM_ERROR_ON_ABORTED_REQUESTS

A boolean specifying if the agent should monitor for aborted TCP connections with un-ended HTTP requests. An error will be generated and sent to the APM Server if this happens.

abortedErrorThresholdedit

  • Type: Number
  • Default: 25s
  • Env: ELASTIC_APM_ABORTED_ERROR_THRESHOLD

Specify the threshold for when an aborted TCP connection with an un-ended HTTP request is considered an error. The value is expected to be in seconds, or should include a time suffix.

If the errorOnAbortedRequests property is false, this property is ignored.

transactionSampleRateedit

  • Type: Number
  • Default: 1.0
  • Env: ELASTIC_APM_TRANSACTION_SAMPLE_RATE
  • dynamic config Central config name: transaction_sample_rate

Specify the sampling rate to use when deciding whether to trace a request.

This must be a value between 0.0 and 1.0, where 1.0 means 100% of requests are traced. The value is rounded to four decimal places of precision (e.g. 0.0001, 0.3333) to ensure consistency and reasonable size when propagating the sampling rate in the tracestate header for distributed tracing.

hostnameedit

  • Type: String
  • Default: OS hostname
  • Env: ELASTIC_APM_HOSTNAME

The OS hostname is automatically logged along with all errors and transactions. If you want to overwrite this, use this option.

frameworkNameedit

  • Type: String
  • Env: ELASTIC_APM_FRAMEWORK_NAME

Set the name of the web framework used by the instrumented service/application. The name will be available as metadata for all errors and transactions sent to the APM Server. This can be useful for debugging and filtering.

By default, the agent will set the value of this config option if the framework can be detected automatically.

frameworkVersionedit

  • Type: String
  • Env: ELASTIC_APM_FRAMEWORK_VERSION

Set the version of the web framework used by the instrumented service/application. The version will be available as metadata for all errors and transactions sent to the APM Server. This can be useful for debugging and filtering.

By default, the agent will set the value of this config option if the framework can be detected automatically.

Example of setting frameworkName and frameworkVersion for a framework named my-custom-framework:

// read the version from the package.json file
var frameworkVersion = require('my-custom-framework/package').version

require('elastic-apm-node').start({
  frameworkName: 'my-custom-framework',
  frameworkVersion: frameworkVersion
})

logLeveledit

  • Type: String
  • Default: 'info'
  • Env: ELASTIC_APM_LOG_LEVEL
  • dynamic config Central config name: log_level

Set the verbosity level for the agent’s logging. Note that this does not have any influence on the types of errors that are sent to the APM Server. This only controls how chatty the agent is in your logs. Possible levels are: trace (the most verbose logging, avoid in production), debug, info, warning, error, critical, and off (disable all logging).

This config only applies when using the built-in logger. Log levels will not be automatically applied to a custom logger.

loggeredit

  • Type: object
  • Env: ELASTIC_APM_LOGGER=false to ignore a custom logger

By default, the APM agent logs to stdout in ecs-logging format. Use the logger config to pass in a custom logger object. The custom logger must provide trace, debug, info, warn, error, and fatal methods that take a string message argument.

A custom logger may result in structured log data being lost. As of version 3.13, the agent uses structured logging using the pino API. To avoid issues with incompatible logger APIs, a given custom logger is wrapped in such a way that only the log message is passed through. As a special case, if the provided logger is a pino logger instance, then it will be used directly without loss of structured fields. Setting the environment variable ELASTIC_APM_LOGGER=false will ignore a custom logger. This is provided to assist with Debug mode troubleshooting.

An example using a custom pino logger:

const pino = require('pino')
require('elastic-apm-node').start({
  logger: pino({ level: 'info' })
})

or using a Bunyan logger:

const bunyan = require('bunyan')
require('elastic-apm-node').start({
  logger: bunyan.createLogger({ level: 'info' })
})

To get the unstructured logging output similar to agent versions before 3.13, use the following:

require('elastic-apm-node').start({
  logger: require('console-log-level')()
})

captureExceptionsedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_CAPTURE_EXCEPTIONS

Whether or not the agent should monitor for uncaught exceptions and send them to the APM Server automatically.

logUncaughtExceptionsedit

  • Type: Boolean
  • Default: false
  • Env: ELASTIC_APM_LOG_UNCAUGHT_EXCEPTIONS

By default the stack trace of a uncaught exception is not written to STDERR when the agent is active. Set this config option to true to have the agent write stack traces of uncaught exceptions to STDERR.

captureErrorLogStackTracesedit

  • Type: String
  • Default: messages
  • Env: ELASTIC_APM_CAPTURE_ERROR_LOG_STACK_TRACES

Normally only Error objects have a stack trace associated with them. This stack trace is stored along with the error message when the error is sent to the APM Server. The stack trace points to the place where the Error object was instantiated.

But sometimes it’s valuable to know, not where the Error was instantiated, but where it was detected. For instance, when an error happens deep within a database driver, the location where the error bubbles up to, is sometimes more useful for debugging, than where the error occurred.

Set this config option to always to — besides the error stack trace — also capture a stack trace at the location where captureError was called.

By default, this config option has the value messages, which means that a stack trace of the capture location will be recorded only when captureError is called with either a string or the special parameterized message object, in which case a normal stack trace isn’t available.

Set this config option to never to never record a capture location stack trace.

A capture location stack trace is never generated for uncaught exceptions.

captureSpanStackTracesedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_CAPTURE_SPAN_STACK_TRACES

Set this option to false to disable capture of stack traces.

When set to true the agent will capture stack traces for spans whose duration falls within the spanFramesMinDuration threshold.

spanFramesMinDurationedit

  • Type: String
  • Default: 10ms
  • Env: ELASTIC_APM_SPAN_FRAMES_MIN_DURATION

A time value to control whether the agent will report stack traces for measured spans. If a span’s duration reaches this threshold, the agent will report stack traces. If captureSpanStackTraces is set to false the agent will ignore the spanFramesMinDuration value.

When set to 0 the agent will not record stack traces for any spans.

When set to a negative value (like -1ms) the agent will always record stack traces for spans.

usePathAsTransactionNameedit

  • Type: Boolean
  • Default: false
  • Env: ELASTIC_APM_USE_PATH_AS_TRANSACTION_NAME

Set this option to true to use the URL path as the transaction name if no other route could be determined. If the agent do not support your router, you can set this option to true to use specific URL path as the transaction name instead of GET unknown route.

sourceLinesErrorAppFrames + sourceLinesErrorLibraryFramesedit

When an error is captured by the agent, its stack trace is stored in Elasticsearch.

By default, the agent will also collect a few lines of source code around the lines for each frame in the stack trace. This can make it easier to determine the cause of an error as the source code related to the error is visible directly in Kibana.

The agent differentiates between so-called in-app frames and library frames. Library frames are frames belonging to Node core and code inside the application’s node_modules folder. In-app frames are everything else.

Use the following two config options to change how many lines of source code to include for the different types of stack frames:

sourceLinesErrorAppFrames

  • Type: Number
  • Default: 5
  • Env: ELASTIC_APM_SOURCE_LINES_ERROR_APP_FRAMES

The default value 5 means that 5 lines of source code will be collected for in-app error frames. 2 lines above the stack frame line + 2 below + the stack frame line itself.

Setting this config option to 0 means that no source code will be collected for in-app error frames.

sourceLinesErrorLibraryFrames

  • Type: Number
  • Default: 5
  • Env: ELASTIC_APM_SOURCE_LINES_ERROR_LIBRARY_FRAMES

The default value 5 means that 5 lines of source code will be collected for error library frames. 2 lines above the stack frame line + 2 below + the stack frame line itself.

Setting this config option to 0 means that no source code will be collected for error library frames.

sourceLinesSpanAppFrames + sourceLinesSpanLibraryFramesedit

When a span is recorded by the agent, a stack trace is recorded together with the span, pointing to the location where the span was initiated. This stack trace is stored in Elasticsearch along with the other span data.

By default, the agent will also collect a few lines of source code around the lines for each frame in the stack trace. This can make it easier to determine why and how the span was initiated as the source code related to the span is visible directly in Kibana.

The agent differentiates between so-called in-app frames and library frames. Library frames are frames belonging to Node core and code inside the applications node_modules folder. In-app frames are everything else.

Use the following two config options to change how many lines of source code to include for the different types of stack frames:

sourceLinesSpanAppFrames

  • Type: Number
  • Default: 0
  • Env: ELASTIC_APM_SOURCE_LINES_SPAN_APP_FRAMES

The default value 0 means that no source code will be collected for in-app span frames.

sourceLinesSpanLibraryFrames

  • Type: Number
  • Default: 0
  • Env: ELASTIC_APM_SOURCE_LINES_SPAN_LIBRARY_FRAMES

The default value 0 means that no source code will be collected for span library frames.

errorMessageMaxLengthedit

  • Type: String
  • Default: 2kb
  • Env: ELASTIC_APM_ERROR_MESSAGE_MAX_LENGTH

The maximum length allowed for error messages. It is expressed in bytes or includes a size suffix such as 2kb. Size suffixes are case-insensitive and include b, kb, mb, and gb. Messages above this length will be truncated before being sent to the APM Server.

Set to -1 do disable truncation.

This applies to the following properties:

  • error.exception.message
  • error.log.message

stackTraceLimitedit

  • Type: Number
  • Default: 50
  • Env: ELASTIC_APM_STACK_TRACE_LIMIT

Setting it to 0 will disable stack trace collection. Any finite integer value will be used as the maximum number of frames to collect. Setting it to Infinity means that all frames will be collected.

transactionMaxSpansedit

  • Type: Number
  • Default: 500
  • Env: ELASTIC_APM_TRANSACTION_MAX_SPANS
  • dynamic config Central config name: transaction_max_spans

Specify the maximum number of spans to capture within a request transaction before dropping further spans. Setting to -1 means that spans will never be dropped.

maxQueueSizeedit

  • Type: Number
  • Default: 1024
  • Env: ELASTIC_APM_MAX_QUEUE_SIZE

The maximum size of buffered events.

Events like transactions, spans, and errors are buffered when the agent can’t keep up with sending them to the APM Server or if the APM server is down. If the queue is full, events are rejected which means you will lose transactions and spans. This guards the application from consuming too much memory and possibly crashing in case the APM server is unavailable for a longer period of time.

A lower value will decrease the heap overhead of the agent, while a higher value makes it less likely to lose events in case of a temporary spike in throughput.

apiRequestTimeedit

  • Type: String
  • Default: 10s
  • Env: ELASTIC_APM_API_REQUEST_TIME

The agent maintains an open HTTP request to the APM Server that is used to transmit the collected transactions, spans, and errors to the server.

To avoid issues with intermittent proxies and load balancers, the HTTP request is ended and a new one created at regular intervals controlled by this config option. The value is expected to be in seconds, or should include a time suffix.

The HTTP request is ended before the time threshold is reached if enough bytes are sent over it. Use the apiRequestSize config option to control the byte threshold.

apiRequestSizeedit

  • Type: String
  • Default: 768kb
  • Env: ELASTIC_APM_API_REQUEST_SIZE

The agent maintains an open HTTP request to the APM Server that is used to transmit the collected transactions, spans, and errors to the server.

To avoid issues with intermittent proxies and load balancers, the HTTP request is ended and a new one created if its body becomes too large. That limit is controlled by this config option. The value is expected to be in bytes, or include a size suffix such as 1mb. Size suffixes are case-insensitive and include b, kb, mb, and gb.

The HTTP request is otherwise ended at regular intervals controlled by the apiRequestTime config option.

serverTimeoutedit

  • Type: String
  • Default: 30s
  • Env: ELASTIC_APM_SERVER_TIMEOUT

Specify the response timeout when reporting transactions to APM Server. The timeout should be in seconds, or should include a time suffix.

The timeout is applied once the agent has sent the entire request body to the APM Server. If the response from the server takes longer than allowed by this timeout, the HTTP request is terminated and the TCP socket closed.

sanitizeFieldNamesedit

  • Type: Array
  • Default: ['password', 'passwd', 'pwd', 'secret', '*key', '*token*', '*session*', '*credit*', '*card*', 'authorization', 'set-cookie', 'pw', 'pass', 'connect.sid']
  • Env: ELASTIC_SANITIZE_FIELD_NAMES
  • dynamic config Central config name: sanitize_field_names

Remove sensitive data sent to Elastic APM.

The sanitizeFieldNames configuration value allows you to configure a list of wildcard patterns of field names which should be redacted from agent payloads. Wildcard matches are case-insensitive by default. You may make wildcard searches case-sensitive by using the (?-i) prefix. These patterns apply to the request and response HTTP headers, as well as any form field captured during an application/x-www-form-urlencoded data request.

The sanitizeFieldNames will redact any matched field names. If you wish to filter or redact other data the filterHttpHeaders configuration field or the API filtering functions may be a better choice.

filterHttpHeadersedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_FILTER_HTTP_HEADERS

When tracing an incoming HTTP request, the agent will add metadata about the requests to the recorded transaction. The same applies for errors that occur and are captured as a result of the request.

This boolean specifies if the agent should anonymize certain sensitive HTTP headers by default before they are sent to the APM Server. When anonymized, the header value will be set to [REDACTED]

Currently, the following HTTP headers are anonymized by default:

  • Authorization - The full value of this header is redacted. In versions of the agent greater than v3.9, the authorization header is redacted by the default configuration of sanitizeFieldNames.
  • Cookie - The cookies inside the Cookie header are analyzed and their values redacted if they appear sensitive (like a session cookie). See the is-secret module for details about which patterns are considered sensitive.

If you wish to filter or sanitize other data, use one of the filtering functions.

disableInstrumentationsedit

  • Type: Array of strings
  • Env: ELASTIC_APM_DISABLE_INSTRUMENTATIONS

Array or comma-separated string of modules to disable instrumentation for. When instrumentation is disabled for a module, no spans will be collected for that module.

Example using options object:

require('elastic-apm-node').start({
  disableInstrumentations: ['graphql', 'express-graphql']
})

Example using environment variable:

ELASTIC_APM_DISABLE_INSTRUMENTATIONS=graphql,express-graphql

For an always up-to-date list of modules for which instrumentation can be disabled, see the lib/instrumentation/modules folder in the agent repository. Note that not all modules represented in this directory will generate spans, and adding those to this array has no effect.

To configure if incoming http requests should be instrumented, see instrumentIncomingHTTPRequests.

containerIdedit

  • Type: String
  • Env: ELASTIC_APM_CONTAINER_ID

Specify the docker container id to associate with all reported events. If absent, it will be parsed out of the /proc/self/cgroup file.

kubernetesNodeNameedit

  • Type: String
  • Env: KUBERNETES_NODE_NAME

Specify the kubernetes node name to associate with all reported events.

kubernetesNamespaceedit

  • Type: String
  • Env: KUBERNETES_NAMESPACE

Specify the kubernetes namespace to associate with all reported events.

kubernetesPodNameedit

  • Type: String
  • Env: KUBERNETES_POD_NAME

Specify the kubernetes pod name to associate with all reported events. If absent, and if kubernetesPodUID is parsed out of the /proc/self/cgroup file, this will default to the local hostname.

kubernetesPodUIDedit

  • Type: String
  • Env: KUBERNETES_POD_UID

Specify the kubernetes pod uid to associate with all reported events. If absent, it will be parsed out of the /proc/self/cgroup file.

metricsIntervaledit

  • Type: String
  • Default: 30s
  • Env: ELASTIC_APM_METRICS_INTERVAL

Specify the interval for reporting metrics to APM Server. The interval should be in seconds, or should include a time suffix.

To disable metrics reporting, set the interval to 0.

metricsLimitedit

  • Type: Number
  • Default: 1000
  • Env: ELASTIC_APM_METRICS_LIMIT

Specify the maximum number of metrics to track at any given time. When a new metric is inserted which would exceed the limit, the oldest metric will be dropped to give it space.

globalLabelsedit

  • Type: Object
  • Env: ELASTIC_APM_GLOBAL_LABELS

Supply a key/value pair object of labels to apply to any data recorded by the agent.

Example:

ELASTIC_APM_GLOBAL_LABELS="subspace=sap-hana,rack=number6"

configFileedit

  • Type: String
  • Default: elastic-apm-node.js
  • Env: ELASTIC_APM_CONFIG_FILE

The Node.js agent will look for a file named elastic-apm-node.js in the current working directory. You can specify a custom path using this config option (this path must include the filename), e.g:

ELASTIC_APM_CONFIG_FILE=/path/to/my-elastic-apm-node.js

The inline version of this config option, that is passed to the start function, will be ignored if a config file was already loaded when this module was required (based on either the default value or because of the ELASTIC_APM_CONFIG_FILE environment variable).

The configuration file is expected to export an object, following the same conventions as the options object, given as the first argument to the start function, e.g.:

module.exports = {
  // Override service name from package.json
  // Allowed characters: a-z, A-Z, 0-9, -, _, and space
  serviceName: '',

  // Use if APM Server requires a token
  secretToken: '',

  // Set custom APM Server URL (default: http://localhost:8200)
  serverUrl: ''
}

breakdownMetricsedit

  • Type: Boolean
  • Default: true
  • Env: ELASTIC_APM_BREAKDOWN_METRICS

Used to disable reporting of breakdown metrics which records self time spent in each unique type of span.

cloudProvideredit

  • Type: String
  • Default: auto
  • Env: ELASTIC_APM_CLOUD_PROVIDER

During startup the Node.js agent queries the local environment to determine whether the application is running in a cloud environment, and provides the agent with details about that environment. These details are called metadata, and will be sent to APM Server with other instrumented data. The cloudProvider configuration value allows you to control this behavior.

  • auto: Automatically determine which cloud provider the agent is running on.
  • gcp: Only query for Google Cloud Platform information.
  • aws: Only query for Amazon Web Service information.
  • azure: Only query for Azure information.
  • none: Do not query for any cloud provider information.

If the value is not one of the five listed above, the agent will use the value of auto.

ignoreMessageQueuesedit

  • Type: Array
  • Default: []
  • Env: ELASTIC_IGNORE_MESSAGE_QUEUES
  • dynamic config Central config name: ignore_message_queues

Array or comma-separated string of wildcard patterns that tell the agent to ignore certain queues/topics when instrumenting messaging systems.

When an instrumented messaging system sends or receives a message, the agent will test the queue/topic name against each wildcard in this list. If the name matches, the agent will skip instrumenting the operation.

The ignoreMessageQueues property supports simple wildcard (*) patterns, and may not include commas. Wildcard matches are case-insensitive by default. You may make wildcard searches case-sensitive by using the (?-i) prefix.

Example usage:

require('elastic-apm-node').start({
  ignoreMessageQueues: [
    'overnight_jobs',
    'events_*',
    '(?-i)caseSensitiveSearch'
  ]
})