Reduce storage

edit

The amount of storage for APM data depends on several factors: the number of services you are instrumenting, how much traffic the services see, agent and server settings, and the length of time you store your data.

Reduce the sample rate

edit

The transaction sample rate directly influences the number of documents (more precisely, spans) to be indexed. It is the easiest way to reduce storage.

The transaction sample rate is a configuration setting of each agent. Reducing it does not affect the collection of metrics such as Transactions per second.

Reduce collected stacktrace information

edit

Elastic APM agents collect stacktrace information under certain circumstances. This can be very helpful in identifying issues in your code, but it also comes with an overhead at collection time and increases the storage usage.

Stacktrace collection settings are managed in each agent.

Delete data

edit

You might want to only keep data for a defined time period. This might mean deleting old documents periodically, deleting data collected for specific services or customers, or deleting specific indices.

Depending on your use case, you can delete data periodically with index lifecycle management, Curator, the Delete By Query API, or in the Kibana Index Management UI.

Delete data with ILM
edit

Index Lifecycle management (ILM) enables you to automate how you want to manage your indices over time. You can base actions on factors such as shard size and performance requirements. See Index lifecycle management to learn more.

Delete data via Kibana Index Management UI
edit

Select the indices you want to delete, and click Manage indices to see the available actions. Then click delete indices.

Manage Indices via Kibana

edit

Kibana’s index management allows you to manage your cluster’s indices, data streams, index templates, and much more.

Update existing data

edit

You might want to update documents that are already indexed. For example, if you your service name was set incorrectly.

To do this, you can use the Update By Query API.

Rename a service

edit

To rename a service, send the following request:

POST *-apm-*/_update_by_query?expand_wildcards=all
{
  "query": {
    "term": {
      "service.name": {
        "value": "current-service-name"
      }
    }
  },
  "script": {
    "source": "ctx._source.service.name = 'new-service-name'",
    "lang": "painless"
  }
}

Remember to also change the service name in the APM agent configuration.