天天看点

filebeat输出增加ip字段

    filebeat (5.x)默认配置中,输出客户端信息 beat.name和beat.hostname 值都是主机名,这样不方便运维快速定位到具体主机,如下图(es中):   

filebeat输出增加ip字段
filebeat输出增加ip字段

     因此在filebeat配置文件中增加字段,并通过环境变量配置ip地址,在es索引中增加“host"字段,值为客户端的真实ip

   filebeat.yml配置增加以下部分:

fields_under_root: true   

fields:

  host: ${serverip}

#serverip 为系统环境变量,具体值为本机ip:192.168.1.121

修改后es索引结果如下:

filebeat输出增加ip字段

继续阅读