1、filbeat容器引入宿主机IP变量。
2、配置文件引入环境变量。
pod引入pod信息的相关变量
env: - name: MY_NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - name: MY_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: MY_POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: MY_POD_IP valueFrom: fieldRef: fieldPath: status.podIP - name: MY_POD_SERVICE_ACCOUNT valueFrom: fieldRef: fieldPath: spec.serviceAccountName
filebeat设置新增字段
filebeat.inputs: - type: log paths: - /opt/test.log scan_frequency: 10s tail_lines: true fields: # 使用 fields 模块添加字段 host_ip: ${SERVER_IP} # host_ip 为字段名称,后面的值为 SERVER_IP 变量值,该变量为系统变量 fields_under_root: true # 将新增的字段放在顶级,收集后字段名称显示 host_ip。如果设置为 false,则放在子集,收集后显示为 fields.host_ip
标签:fieldRef,name,ip,valueFrom,宿主机,kibana,fieldPath,MY From: https://www.cnblogs.com/zhangxiaokui/p/17199255.html