Configure Real User Monitoring (RUM)edit

Real User Monitoring captures user interaction with clients such as web browsers. The JavaScript Agent is Elastic’s RUM Agent.

By default, Real User Monitoring is disabled. To enable it, set apm-server.rum.enabled to true in your APM Server configuration file.

In addition, if APM Server is deployed in an origin different than the page’s origin, you will need to configure Cross-Origin Resource Sharing (CORS) in the Agent.

A full list of APM Server configuration options is available in the RUM configuration reference.

Example config with RUM enabled:

apm-server.rum.enabled: true
apm-server.rum.event_rate.limit: 300
apm-server.rum.event_rate.lru_size: 1000
apm-server.rum.allow_origins: ['*']
apm-server.rum.allow_headers: ["header1", "header2"]
apm-server.rum.library_pattern: "node_modules|bower_components|~"
apm-server.rum.exclude_from_grouping: "^/webpack"
apm-server.rum.source_mapping.enabled: true
apm-server.rum.source_mapping.cache.expiration: 5m
apm-server.rum.source_mapping.index_pattern: "apm-*-sourcemap*"

Configurationedit

enablededit

To enable RUM support, set apm-server.rum.enabled to true. By default this is disabled.

event_rate.limitedit

Defines the maximum amount of events allowed to be sent to the APM Server RUM endpoint per ip per second. Defaults to 300.

event_rate.lru_sizeedit

An LRU cache is used to keep a rate limit per IP for the most recently seen IPs. This setting defines the number of unique IPs that can be tracked in the cache. Sites with many concurrent clients should consider increasing this limit. Defaults to 1000.

allow_service_namesedit

A list of permitted service names for RUM support. This can be set to restrict RUM events to those with one of a set of known service names, in order to limit the number of service-specific indices or data streams created. By default this is not set, allowing any service name.

allow_originsedit

A list of permitted origins for RUM support. User-agents send an Origin header that will be validated against this list. This is done automatically by modern browsers as part of the CORS specification. An origin is made of a protocol scheme, host and port, without the URL path. Default value is set to ['*'], which allows everything.

allow_headersedit

By default, HTTP requests made from the RUM agent to the APM Server are limited in the HTTP headers they are allowed to have. If any other headers are added, the request will be rejected by the browser due to Cross-Origin Resource Sharing (CORS) restrictions. If you need to add extra headers to these requests, you can use this configuration to allow additional headers. The default list of values includes "Content-Type", "Content-Encoding", and "Accept"; custom values configured here are appended to the default list and used as the value for the Access-Control-Allow-Headers header.

library_patternedit

RegExp to be matched against a stacktrace frame’s file_name and abs_path attributes. If the RegExp matches, the stacktrace frame is considered to be a library frame. When source mapping is applied, the error.culprit is set to reflect the function and the filename of the first non library frame. This aims to provide an entry point for identifying issues. Default value is "node_modules|bower_components|~".

exclude_from_groupingedit

RegExp to be matched against a stacktrace frame’s file_name. If the RegExp matches, the stacktrace frame is excluded from being used for calculating error groups. The default pattern excludes stacktrace frames that have a filename starting with /webpack.

source_mapping.enablededit

Used to enable/disable sourcemapping for RUM events. Defaults to true.

source_mapping.elasticsearchedit

Configure the Elasticsearch source map retrieval location, taking the same options as output.elasticsearch. This must be set when using an output other than Elasticsearch, and that output is writing to Elasticsearch. Otherwise leave this section empty.

source_mapping.cache.expirationedit

If a source map has been uploaded to the APM Server, source mapping is automatically applied to documents sent to the RUM endpoint. Source maps are fetched from Elasticsearch and then kept in an in-memory cache for the configured time. Values configured without a time unit are treated as seconds. Default value is 5 minutes.

source_mapping.index_patternedit

Source maps are stored in a separate index apm-%{[observer.version]}-sourcemap by default. If changed, a matching index pattern needs to be specified here.

Ingest pipelinesedit

The default APM Server pipeline includes processors that enrich RUM data prior to indexing in Elasticsearch. See the default ingest pipeline for details on how to locate, edit, or disable this pre-processing.