json - 来自 Kubernetes 的 Filebeat 和 json 日志不起作用
问题描述
我已经使用带有 Elasticsearch 和 Kibana 6.8.6 以及 Filebeat 7.5.1 的 minikube 设置了一个示例 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: message
您的 filebeat 配置
推荐阅读
- java - 使用 Java Streams 获取嵌套在 HashMap 中的最多元素的 Set
- rust - 如何同时使用 futures 0.1 和 futures-preview 0.3 板条箱?
- react-native - React Native:使用选项卡和选项卡中的 faltlist 动画收缩标题
- swift - 如何使用 CIFilter 生成 dataMatrix?
- vhdl - 状态机和无符号信号
- excel - 如何一次隐藏多个pivotitem
- r - 在 R 中将路径/路线图编写为 GeoTiff
- batch-processing - 在批处理文件中组合两个调用命令
- java - 更高效的密码检查器
- r - 如何从 R 中的数值变量创建虚拟变量?