1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| input { beats { port => 5044 } } filter{ grok{ match => [ "message","(?<logtime>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{3})\|#\|(?<level>.*)\|#\|(?<event>.*)\|#\|(?<text>.*)\|#\|message: (?<msg>.*)" ] remove_field => "message" } date { match => [ "logtime", "YYYY-MM-dd HH:mm:ss.SSS", "ISO8601" ] target => "@timestamp" timezone => "Asia/Shanghai" } mutate{ remove_field => [ "@version","[beat][hostname]","[beat][name]","[beat][version]","[agent][ephemeral_id]","[agent][hostname]","[agent][id]","[agent][type]","[agent][version]","[cloud][availability_zone]","[cloud][instance][id]","[cloud][instance][name]","[cloud][machine][type]","[cloud][provider]","[ecs][version]","tags","[host][name]" ] } } output { if [fields][net] { elasticsearch { hosts => ["192.168.1.100:9200"] index => "%{[fields][net]}-%{[fields][app]}-%{+YYYY-MM}" user => es用户 password => es密码 } } else { elasticsearch { hosts => ["192.168.1.100:9200"] index => "%{index}-%{+YYYY-MM}" user => es用户 password => es密码 } }
}
|