filebeat (5.x)預設配置中,輸出用戶端資訊 beat.name和beat.hostname 值都是主機名,這樣不友善運維快速定位到具體主機,如下圖(es中):
是以在filebeat配置檔案中增加字段,并通過環境變量配置ip位址,在es索引中增加“host"字段,值為用戶端的真實ip
filebeat.yml配置增加以下部分:
fields_under_root: true
fields:
host: ${serverip}
#serverip 為系統環境變量,具體值為本機ip:192.168.1.121
修改後es索引結果如下: