简体   繁体   English

Grafana 的 Elasticsearch 数据源不工作

[英]Elasticsearch Datasource for Grafana not working

I have Grafana working with Prometheus as default datasource.我让 Grafana 使用 Prometheus 作为默认数据源。 Want to add Elasticsearch as a secondary data source.想要添加 Elasticsearch 作为辅助数据源。 My environment is running in kubernetes with Elasticsearch: 7.2.0, Grafana: 6.4.4我的环境在 kubernetes 中运行,Elasticsearch:7.2.0,Grafana:6.4.4

But getting error No date field named undefined found但是出现错误No date field named undefined found

I am able to curl 'http://elasticsearch:9200/_cat/indices?v&pretty' from Grafana pod我可以从 Grafana pod curl 'http://elasticsearch:9200/_cat/indices?v&pretty'

root@shell-545fcb88cc-grn9t:/# curl -XGET 'http://elasticsearch:9200/_cat/indices?v&pretty'
health status index                              uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   syslog-2019.11.03                  hfPuNniuTaKiKm6LZYazCg   1   1        277            0    386.9kb        193.4kb
green  open   syslog-2019.11.05                  JutF5UINTJaencoQ2TDllg   1   1        636            0    664.5kb        332.2kb
green  open   syslog-2019.10.31                  PynRH8ZMT0OwwpEKOvJgwg   1   1         42            0    164.1kb           82kb
green  open   filebeat-7.2.0-2019.10.03-000002   hhi_PGsaRWu9W2Lb565cyg   1   1   24963987            0     20.2gb         10.1gb
green  open   metricbeat-7.2.1-2019.10.03-000002 2ek3X0h-R5ONjD51sVcOCg   1   1    2757322            0        1gb        552.9mb
green  open   syslog-2019.11.02                  e9mcQ3KYS3yfegO7i6pn9g   1   1        319            0    475.4kb        237.7kb
green  open   metricbeat-7.2.0-2019.10.22-000003 ssCSFuT0QaikLW8OiKP1Kw   1   1  120115580            0     79.2gb         39.6gb
green  open   syslog-2019.11.07                  PcdvTxMRTnqS0ZUBlyK1rA   1   1       8538            0        5mb          2.5mb
green  open   filebeat-7.2.0-2019.11.02-000003   4MIsjbyKQ52DVxOUxeM9AQ   1   1    6350545            0      4.7gb          2.3gb
green  open   filebeat-7.2.0-2019.09.03-000001   eYZWZhv0RjybEkkUImJIiQ   1   1   25802336            0     21.3gb         10.6gb
green  open   syslog-2019.10.30                  e6m-tWt2S7S5fx739HIvCA   1   1       1143            0    823.7kb          419kb
green  open   metricbeat-7.2.1-2019.11.02-000003 iVEXirNxTJWbz8aCmpDENA   1   1          0            0       566b           283b
green  open   filebeat-7.2.1-2019.09.03-000001   I8vRGDnrR-6Cl5oPwCzjuw   1   1    4651714            0      3.4gb          1.7gb
green  open   metricbeat-7.2.0-2019.09.03-000001 abOCdQ4WTS62M75gpG6qkA   1   1  149807959            0      100gb           50gb
green  open   metricbeat-7.2.0-2019.09.28-000002 uYvCxqH7SpSKDYDdF1z_Rg   1   1  151770825            0      100gb           50gb
green  open   syslog-2019.11.06                  9onA0R_qTTKeroZvGlKCIg   1   1       3098            0      2.6mb          1.3mb
green  open   metricbeat-7.2.1-2019.09.03-000001 ZQ3-urydTn2kMhYDPtRqYQ   1   1    8700321            0      3.7gb          1.8gb
green  open   filebeat-7.2.1-2019.10.03-000002   Xkwv7LQVSm6yVqBSZKVKCg   1   1     389496            0    285.6mb        143.2mb
green  open   filebeat-7.2.1-2019.11.02-000003   5PwPy8jRQEC3bmW9hFctxg   1   1          0            0       566b           283b
green  open   syslog-2019.11.01                  wFgiLIxgQ9m4R8c1plR6UQ   1   1        943            0      933kb        457.6kb
green  open   syslog-2019.11.04                  OoaAXVTwRhiJfMlCFqI27Q   1   1       1469            0      1.3mb        713.4kb

Data Sources / Elasticsearch数据源 / Elasticsearch

HTTP HTTP

URL: http://elasticsearch:9200 URL: http://elasticsearch:9200

Access: Server (Default)访问: Server (Default)

Auth认证

No auth is selected.未选择任何身份验证。

Elasticsearch details Elasticsearch 详细信息

Index name: metricbeat-7.2.0-2019.10.22-000003索引名称: metricbeat-7.2.0-2019.10.22-000003

Pattern: No pattern图案: No pattern

Time field name: @timestamp时间字段名称: @timestamp

Version: 7.0+版本: 7.0+

Max concurrent Shard Requests: 5最大并发分片请求数: 5

Min time interval: 10s最小时间间隔: 10s

Logs日志

Message field name: (Blank)消息字段名称:( (Blank)

Level field name: (Blank)级别字段名称:( (Blank)

For now I just want to get metricbeat logs.现在我只想获取 metricbeat 日志。 How can I get this working, Also can I specify wildcard index name?我怎样才能让它工作,我也可以指定通配符索引名称吗?

Your Elasticsearch datasource configuration is a problem, because it covers only 1 index from one day:您的 Elasticsearch 数据源配置有问题,因为它仅涵盖一天的 1 个索引:

Index name: metricbeat-7.2.0-2019.10.22-000003
Pattern: No pattern

Index names are very variable:索引名称变化很大:

metricbeat-7.2.0-2019.09.03-000001
metricbeat-7.2.0-2019.09.28-000002
metricbeat-7.2.0-2019.10.22-000003
metricbeat-7.2.1-2019.09.03-000001
metricbeat-7.2.1-2019.10.03-000002
metricbeat-7.2.1-2019.11.02-000003

So your index names don't have generic names.因此,您的索引名称没有通用名称。 I recommend to configure custom index name in beat configuration:我建议在节拍配置中配置自定义索引名称:

output.elasticsearch.index: "metricbeat-%{+yyyy.MM.dd}"

Then it can be configured in Grafana as:然后可以在 Grafana 中配置为:

Index name: [metricbeat-]YYYY.MM.DD
Pattern: Daily

Eventually, you can create index alias, which includes all current index name variations and you will use that alias in the Grafana configuration.最终,您可以创建索引别名,其中包括所有当前索引名称变体,您将在 Grafana 配置中使用该别名。

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

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