["logq","applog"] # 可配置多个topic group_id => "test" # 消费者组 client_id => "test" _logstash kafka ">
赞
踩
input { kafka { bootstrap_servers => ["192.168.110.31:9092,192.168.110.31:9093,192.168.110.31:9094"] topics => ["logq","applog"] # 可配置多个topic group_id => "test" # 消费者组 client_id => "test" # auto_offset_reset => "latest" # 从最新的偏移量开始消费 decorate_events => true # 附加 topic、offset、group、partition 等信息 ... max_partition_fetch_bytes => "5242880" consumer_threads => "5" codec => "json" } } filter { if ([level] == "ERROR" or [level] == "WARN") and [systemCode] =~ "ng*" { ruby { code => 'event.set("logdate", Time.at(event.get("logTime")/1000+8*60*60).to_s)' } date { match => ["logdate", "yyyy-MM-dd HH:mm:ss Z"] target => "@timestamp" } mutate { add_field => { "mm" => "%{+mm}" } } ruby { code => 'event.set("minute", event.get("mm").to_i/10)' } mutate { remove_field => [ "mm", "logdate", "@version", "host", "path", "tags", "message" ] } } else { ruby { code => "event.cancel" } } } output { file { path => "/data/monitor/monitor.log.%{+YYYYMMddHH}%{minute}" } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。