Connecting EraSearch to Grafana
Estimated time to read: 3 minutes
Acquisition notice
In October 2022, ServiceNow acquired Era Software. The documentation on this site is no longer maintained and is intended for existing Era Software users only.
To get the latest information about ServiceNow's observability solutions, visit their website and documentation.
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¶
- Navigate to your Grafana UI.
- Click Configuration > Data sources.
- 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
, whereYOUR_API_KEY
is the API key for your EraCloud account.
- Set Header to
- 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
whereAPI_KEY
is your EraSearch API key.
- Set Header to
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:
- Click Create > Dashboard > Add a new panel.
- Click the Data source drop-down and select EraSearch:gatlinburg.
- To set the time interval for the panel:
- Click Last 6 hours.
- Enter
2021-10-27 04:00:00
and2021-10-27 14:00:00
in the From and To inputs. - Click Apply time range.
- 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.