【问题标题】:Filebeat and json logs from Kubernetes not working来自 Kubernetes 的 Filebeat 和 json 日志不起作用
【发布时间】:2020-04-19 14:12:36
【问题描述】:

我使用 minikube 和 Elasticsearch 和 Kibana 6.8.6 以及 Filebeat 7.5.1 设置了一个示例 Kubernetes 集群。

我的应用程序生成 json 格式的日志消息{"@timestamp":"2019-12-30T21:59:48+0000","message":"example","data":"data-462"}

我可以在 Kibana 中看到日志消息,但我的 json 日志作为字符串嵌入在“消息”属性中:

我将json.keys_under_root: true 配置为无效(如文档中所述:https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-log.html#filebeat-input-log-config-json

我的配置:

  filebeat.yml: |-
    migration.6_to_7.enabled: true

    filebeat.config:
      modules:
        path: ${path.config}/modules.d/*.yml
        reload.enabled: false

    filebeat.autodiscover:
      providers:
        - type: kubernetes
          hints.enabled: true
          hints.default_config.enabled: false
          json.keys_under_root: true
          json.add_error_key: true

    output.elasticsearch:
      hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
      username: ${ELASTICSEARCH_USERNAME}
      password: ${ELASTICSEARCH_PASSWORD}
  kubernetes.yml: |-
    - type: docker
      containers.ids:
      - "*"
      processors:
        - add_kubernetes_metadata:
            in_cluster: true

我需要“消息”和“数据”字段作为 Kibana 中的单独字段。

我错过了什么?

【问题讨论】:

  • 设置json.message_key: log

标签: json kubernetes minikube filebeat


【解决方案1】:

尝试在您的 filebeat 配置中添加 json.message_key: message

【讨论】:

  • 它不起作用......(虽然,根据我对文档的理解,它应该)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-01-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-18
  • 2019-08-25
  • 2018-04-29
相关资源
最近更新 更多