Skip to content

Connecting EraSearch to Grafana

Estimated time to read: 3 minutes

Grafana is an open source visualization platform. You can use it with EraSearch to visualize your log data in dashboards and graphs.

In this guide, you'll connect your EraSearch database to Grafana. You'll also visualize data from one of your EraSearch indexes.

Before you begin

This guide assumes you've installed and are running the Grafana UI.

For EraCloud users, you need your EraSearch service URI and API key to complete the steps below. If you don't have an EraCloud account yet, visit the Getting started series.

For self-hosted EraSearch users, you need the URL of your EraSearch database instance. If you set up EraSearch RBAC, you also need an API key that maps to a read-only role for all relevant indexes.

Sample data

This page uses the sample data below. If you'd like to follow along, feel free to write the data to your database.

{"index":{"_index":"gatlinburg"}}
{"temperature":50,"_ts":1635328800000}
{"index":{"_index":"gatlinburg"}}
{"temperature":49,"_ts":1635330600000}
{"index":{"_index":"gatlinburg"}}
{"temperature":49,"_ts":1635339600000}
{"index":{"_index":"gatlinburg"}}
{"temperature":43,"_ts":1635340800000}
{"index":{"_index":"gatlinburg"}}
{"temperature":40,"_ts":1635342300000}
{"index":{"_index":"gatlinburg"}}
{"temperature":39,"_ts":1635353100000}

Connecting EraSearch to Grafana

Step 1: Add your data source

  1. Navigate to your Grafana UI.
  2. Click Configuration > Data sources.
  3. Next, click Add data source and select Elasticsearch to access the data source settings.

Note

This guide uses the Elasticsearch data source to connect EraSearch to Grafana. That workflow is possible because the EraSearch REST API supports much of the Elasticsearch API.

Step 2: Configure HTTP and Auth for your data source

In the Settings tab for your new data source, assign a Name to your data source. For example, using the sample data above, EraSearch:gatlinburg. Next, set up HTTP and Auth:

  • Enter the service URI for your EraCloud account in the URL input.
  • Under Custom HTTP Headers, click Add header and:
    • Set Header to Authorization.
    • Set Value to Bearer YOUR_API_KEY, where YOUR_API_KEY is the API key for your EraCloud account.
  • Enter your EraSearch database's URL in the URL input, for example, http://localhost:9200.
  • Under Auth, check Basic auth and:
    • Set User to your EraSearch username.
    • Set Password to your EraSearch password.
  • If you're using EraSearch RBAC, under Custom HTTP Headers, click Add header and:
    • Set Header to Authorization.
    • Set Value to Bearer API_KEY where API_KEY is your EraSearch API key.

Step 3: Configure additional data source details and verify your setup

In the Elasticsearch details section, configure the following:

  • Set Index name to the EraSearch index you'd like to query, for example, gatlinburg.
  • Enter _ts in the Time field name input.
  • Click the Version drop-down and select 7.0+.

To verify your data source configuration, click Save & test. When Grafana connects to your data source, Grafana displays Index OK. Time field name OK.

Step 4: Visualize your data

Follow the steps below to create a new dashboard and visualize the sample data:

  1. Click Create > Dashboard > Add a new panel.
  2. Click the Data source drop-down and select EraSearch:gatlinburg.
  3. To set the time interval for the panel:
    1. Click Last 6 hours.
    2. Enter 2021-10-27 04:00:00 and 2021-10-27 14:00:00 in the From and To inputs.
    3. Click Apply time range.
  4. In the query input, enter temperature:* to visualize the number of temperatures recorded per hour.

Next steps

For more in-depth guidance on configuring a data source, visit Using Elasticsearch in Grafana. To learn about EraSearch's data exploration and query tool, visit Exploring data in EraSearch's UI.


Last update: October 6, 2022