Era Software

Connecting EraSearch to Grafana

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 content is intended for engineers and developers using EraSearch on EraCloud. To create an EraCloud account, visit the Getting started series.

The steps below also assume you have the following:

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:

  1. Assign a Name to your data source, for example, using the sample data above, EraSearch:gatlinburg
  2. Enter the Service URI for your EraCloud account in the URL input
  3. 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

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

In the Elasticsearch details section, follow these steps to configure details about your data:

  1. Set Index name to the EraSearch index you'd like to query, for example, gatlinburg
  2. Enter _ts in the Time field name input
  3. Click the Version drop-down and select 7.0+
  4. Set Min time interval to your data's write frequency, for example, 1h

To verify your data source configuration, click Save & test. When successful, 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 an empty 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 the EraSearch UI.