K8S 日志收集:logstash 安装

Posted 不忘初心-铃

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

编写配置文件

[[email protected] 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 &

以上是关于K8S 日志收集:logstash 安装的主要内容,如果未能解决你的问题,请参考以下文章

ELK v3 logstash收集日志以收集系统日志messages为例

logstash收集日志,多台机器,必须要多台机器安装部署吗

k8s日志收集解决方案

efk 日志集群架构了解

linux安装logstash7.6.1及搭建简单ELK--logstash收集nginx日志

filebeat+elasticsearch+logstash+kibana收集系统日志(docker)