4
votes

I'm currently trying to create a graph on Grafana to monitor the status of my servers, however, I can't seem to find a way to use the value of a field as the value to be displayed on the graph. (Datasource is ElasticSearch)

The following "document" is going to be sent to GrayLog (which saves to Elastic) every 1 minute for an array of regions.

{
  "region_key": "some_key",
  "region_name": "Some Name",
  "region_count": 1610
}

By using the following settings, I can get Grafana to display the count of messages it received for each region, however, I want to display the number on the region_count field instead.

Grafana Configuratio Result:

Resulting graph

How can I accomplish this? is this even possible using Elastic as the datasource?

1

1 Answers

1
votes

1) Make sure that your document includes a timestamp in ElasticSearch.

2) In the Query box, provide the Lucene query which narrows down the documents to only those related to this metric

3) In the Metric line, press "Count" and change that to one which takes a specific field: for example, "Average"

4) Next to the "Average" box will appear "select field", which is a dropdown of the available fields. If you see unexpected fieldnames here, it's probably because your Lucene query isn't specific enough. (Kibana can be useful for getting this query right)