K8S 日志收集(四):logstash 安装

下载logstash

wget https://artifacts.elastic.co/downloads/logstash/logstash-6.2.4.rpm
rpm -ivh http://192.168.19.111:8080/panjunbai/logstash-6.2.4.rpm

编写配置文件

[root@kibana logstash]# cat /etc/logstash/conf.d/f1.conf 
input {
  kafka{
        bootstrap_servers => ["192.168.7.204:9092"]
        client_id => "testpanjunbai"
        group_id => "testpanjunbai"
        auto_offset_reset => "latest" 
        consumer_threads => 1
        decorate_events => false
        topics => ["20180421"]
        codec => "json"}
}

output{  
  elasticsearch{  
    hosts=>["192.168.19.93:9200"]  
    index=> "%{[kubernetes][container_name]}-%{+YYYY-MM-dd}"      
    action => "index"

      
    } 
}

启动logstash

export  LS_SETTINGS_DIR=/etc/logstash/
/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/f1.conf &
posted @ 2018-04-28 11:08  长风七万里  阅读(1037)  评论(0编辑  收藏  举报