Reddy SK
Reddy SK

Reputation: 1374

Unable to build query in Grafana to elastic source in variables templating

I am fighting with build proper query for templated variable in Grafana.

I would like to build query type variable which will take all values from field sourceEnvironment.

Document example:

{
  "host" : "10.6.0.132",
  "memoryFree" : 927296,
  "type" : "system",
  "path" : "/appl/Axway-7.5.3/apigateway/events/group-6_instance-9.log",
  "memoryTotal" : 16258844,
  "@timestamp" : "2019-06-17T00:00:27.216Z",
  "@version" : "1",
  "memoryUsed" : 16073968,
  "sourceEnvironment" : "test",
}

I have searched a lot of articles and official documentation but no hint works for me.

Based on https://grafana.com/blog/2016/03/09/how-to-effectively-use-the-elasticsearch-data-source-in-grafana-and-solutions-to-common-pitfalls/ it should be

{“find”: “terms”, “field”: “sourceEnvironment”}

But still getting error:

Template variables could not be initialized: Unexpected token “ in JSON at position 1

Any idea what's wrong?

Thanks and regards, Reddy

enter image description here

Upvotes: 0

Views: 1502

Answers (1)

Bellinda Baumgartner
Bellinda Baumgartner

Reputation: 127

Seems like the "-characters might cause the problem. Try to replace them by typing them in again or copy and paste my example below.

This should definitely work:

{"find":"terms","field":"sourceEnvironment"}

Upvotes: 2

Related Questions