无法在Grafana中建立查询以将变量模板中的弹性源

时间:2019-06-19 11:17:35

标签: grafana grafana-templating

我正在为Grafana中的模板变量构建适当的查询。

我想构建查询类型变量,该变量将从字段sourceEnvironment中获取所有值。

文档示例:

{
  "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",
}

我搜索了很多文章和官方文档,但没有任何提示适合我。

基于https://grafana.com/blog/2016/03/09/how-to-effectively-use-the-elasticsearch-data-source-in-grafana-and-solutions-to-common-pitfalls/,应该为

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

但仍然出现错误:

  

模板变量无法初始化:意外的令牌“ in   JSON位于位置1

有什么想法吗?

感谢和问候,雷迪

enter image description here

1 个答案:

答案 0 :(得分:2)

似乎是“-字符可能会引起问题。请尝试再次输入以替换它们,或在下面复制并粘贴我的示例。

这绝对可以工作:

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