logstash配置文件

   日期:2020-05-22     浏览:128    评论:0    
核心提示:input{ kafka{+ bootstrap_servers => [192.168.234.*:9092,192.168.234.*:9092] group_id => loan-log-consumer auto_offset_reset => latest consumer_threads => 5 topics => [loan-log] type => loan }}filter{ if[type].大数据
input{
	kafka{+
		bootstrap_servers => ["192.168.234.*:9092,192.168.234.*:9092"]
		group_id => "loan-log-consumer"
		auto_offset_reset => "latest"
		consumer_threads => 5
		topics => ["loan-log"]
		type => "loan"
	}
}


filter{
	if[type] == "loan"{
        mutate{
        split=>["message","|"]
			add_field => {
					"application" => "%{[message][0]}"
			}
			add_field => {
					"ip" => "%{[message][1]}"
			}
			add_field => {
					"traceId" => "%{[message][2]}"
			}
			add_field => {
					"parentSpanId" => "%{[message][3]}"
			}
			add_field => {
					"spanId" => "%{[message][4]}"
			}
			add_field => {
					"tmpTime" => "%{[message][5]}"
			}
			add_field => {
					"thread" => "%{[message][6]}"
			}
			add_field => {
					"level" => "%{[message][7]}"
			}
			add_field => {
					"class" => "%{[message][8]}"
			}
			add_field => {
					"msg" => "%{[message][9]}"
			}
			remove_field => ["message"]
        }
	date {
        	match => [ "tmpTime", "yyyy-MM-dd HH:mm:ss.SSS" ]
        	target => "time"
		remove_field => ["tmpTime"]
      	     }
	}
}

output {
	if[type] == "loan"{
	  elasticsearch{
		   hosts => ["192.168.234.*:9200","192.168.234.*:9200"]
		   index => "loan-index-%{+YYYY.MM.dd}"
		   timeout => 300
		   manage_template => false
		   template_name => "loan_template"
	  }
	}
}

 

 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服