简体   繁体   English

如何从 ElasticSearch 创建两级 Grafana 变量?

[英]How to create two levels Grafana Variable from ElasticSearch?

I work on creating some Grafana dashboards.我致力于创建一些 Grafana 仪表板。 At the moment, from ElasticSearch data source.目前,来自 ElasticSearch 数据源。

When I am trying to create a variable in Grafana like the one below:当我尝试在 Grafana 中创建一个变量时,如下所示:

{"find": "terms", "field":  "myServer.name"}

I get None, instead of getting these names: heroku , k8s , aws .我得到None,而不是得到这些名字: herokuk8saws

I tried looking through docs and existing StackOverflow questions, but it is still unclear how I can make it work.我尝试查看文档和现有的 StackOverflow 问题,但仍不清楚如何使其工作。 在此处输入图片说明

Am I doing it wrong, or is it Grafana's limitation?是我做错了,还是 Grafana 的限制?

I ended up with this query:我结束了这个查询:

{"find": "terms", "field":  "myServer.name", "query": "myServer.name:*"}

The problem was not in the query itself but the type.问题不在于查询本身,而在于类型。 If I switch myServer.name from type text to type keyword , it starts working.如果我将 myServer.name 从 type text切换到 type keyword ,它就会开始工作。

As a result, I need to change the template and reindex my logs in ElasticSearch and Filebeat.因此,我需要更改模板并在 ElasticSearch 和 Filebeat 中重新索引我的日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM