安装
tar -zxvf logstash-6.2.2.tar.gz
mv logstash-6.2.2 /home/elk/logstash-6.2.2-01
cp -r /home/elk/logstash-6.2.2-01 /home/elk/logstash-6.2.2-02
配置
logstash-pipeline01.conf
input{
kafka{
bootstrap_servers => ["172.30.1.199:9092"]
client_id => "nic01"
group_id => "nic"
#从最新的偏移量开始消费
auto_offset_reset => "latest"
consumer_threads => 7
#此属性会将当前topic、offset、group、partition等信息也带到message中
decorate_events => true
codec => "json"
#数组类型,可配置多个topic
topics => ["test-business","test-peccancy","test-carwash","test-oilcard","test-personalcenter","test-system","test-task","test-consumer"]
#所有插件通用属性,尤其在input里面配置多个数据源时很有用
type => "chengniu"
}
}
output {
elasticsearch {
#ES集群
hosts => ["172.30.1.1:9250", "172.30.1.1:9251","172.30.1.1:9252","172.30.1.1:9253","172.30.1.1:9254"]
index => "nic-%{[fields][service]}-%{+YYYY.MM.dd}"
}
}
logstash-pipeline02.conf
配置同上
启动
进入bin目录下执行:
./logstash -f ../config/logstash-pipeline01.conf
或
nohup ./logstash -f ../config/logstash-pipeline01.conf &