The Elastic (ELK) Stack
Read time: 3 minutes
Last edited: Jun 18, 2021
This topic explains how to use the LaunchDarkly Elastic (ELK) Stack integration. The Elastic Stack, which is also referred to as the ELK Stack, is a versatile search platform with many use cases, from site and application search to observability and security.
LaunchDarkly's Elastic Stack integration supports log aggregation and data and timeseries visualization.
For example, an engineer is alerted to an anomaly in their application's behavior. With the LaunchDarkly Elastic Stack integration sending data to their observability stack, they can easily correlate flag changes atop timeseries and see what changes happened just before the anomalous activity.
Development teams could also build data visualizations around their LaunchDarkly audit log data to find out more about who interacts with or modifies their feature flags. You can even use Elasticsearch to find specific information in your logs.
To configure the Elastic integration, you must have the following prerequisites:
Your Elasticsearch endpoint URL: This is the destination to which LaunchDarkly sends its data. It must include the socket number. If you are using the Elastic Search Service from Elastic Cloud, you can find your endpoint URL by clicking your deployment name and selecting Copy Endpoint URL just below the Elasticsearch logo.
API Key credentials: To learn more about getting an API key, read Elastic's API Key Documentation. Ensure this key gives permission to write to the appropriate Elasticsearch index.
Elasticsearch index: The Elasticsearch index indicates which index the LaunchDarkly data should be written to in your cluster. You can use the default or choose your own.
Here's how to configure the Elastic Stack integration:
- Navigate to the LaunchDarkly integrations page.
- Click to expand the Elastic (ELK) Stack card.
- Click + integration.
- (Optional) Enter a human-readable Name.
- Paste in the Elasticsearch Endpoint URL.
- Paste in the Authentication Token. This is the base64 encoding of
api_key, joined by a colon.
- Enter or use the default value for the Elasticsearch Index to which you want to write your LaunchDarkly data.
- Click Save Elastic (ELK) Stack Configuration.
After you configure the integration, LaunchDarkly sends flag, environment, and project data to your Elastic cluster.
The Policy configuration field allows you to control which kinds of LaunchDarkly events are sent to Elasticsearch. The default policy value restricts it to flag changes in production environments:
You may want to override the default policy if you wanting to restrict the integration to a specific combination of LaunchDarkly projects and environments or to a specific action or set of actions.
In the example below, the policy restricts LaunchDarkly to only send changes from the
web-app project's production environment to Elasticsearch:
Alternatively, you use the integration to monitor not just flag changes, but all environment and project changes. If you want to send absolutely everything to Elasticsearch, you must add policies for project and environment data:
To send more data to Elasticsearch:
- Navigate to the LaunchDarkly Integrations page.
- Click to Edit the Elastic (ELK) Stack card.
- If the current policy is already expanded, click cancel in the lower-right. Otherwise click + Add statement under Policy.
- Enter a statement for the resources you would like to send to Elasticsearch. For example,
proj/*will send all project data and
proj/*:env/*will send all environment data from all projects.
- Click Update.
- Repeat steps 2 and 3 for each additional category of data you'd like sent to Elasticsearch.
- When you've added all the policies you wish, click Save Elastic (ELK) Stack Configuration.
To learn more about setting custom policies, read Policies in custom roles.
Kibana is a front-end application that provides search and data visualization for data indexed in Elasticsearch.
After you configure the Elastic (ELK) Stack integration, your LaunchDarkly data streams to Elasticsearch and becomes available for searching. You can use Kibana to visualize the data Elastic (ESK) Stack receives.
You must configure your Kibana instance to retrieve this data and display it in its own visualizations or annotate your existing timeseries charts.
To make data available to Kibana, you must create a new index pattern:
- Log into your Kibana instance.
- Navigate to Settings in the left-hand navigation by clicking on the gear icon.
- Under Kibana, select Index Patterns.
- Click Create Index Pattern.
- Enter the appropriate pattern to refer to your LaunchDarkly index or indices. If you used the default value,
launchdarkly-auditwill match specifically that new index. Wildcards are supported, so you may want to end your pattern with
*to support feature log index cycling.
datefor the Time Filter field name.
- Click Create index pattern.
- Verify your data appears correctly by using the Discover section of Kibana and selecting your new index pattern.
Now you can use your LaunchDarkly data alongside everything else in Kibana.
You can continue reading Elastic's documentation to learn more about these products: