首页 > 其他 > 详细

filter

时间:2016-07-22 01:01:18      阅读:257      评论:0      收藏:0      [点我收藏+]

(1)json filter
数据格式是JSON,那么可以通过它吧数据解析成你想要的数据结构

json 设置参数
filter{
json {
add_filed =>..... #hash(可选项),默认,#意思就是添加字段
add_tag =>..... #array(可选项)
remove_field
remove_tag
source=> #string(必选),这是指定来源数据,一般都是message
target => #string,定义将要解析的目标字段

}
}

例子:
input{
stdin {}
}
filter {
json{
source =>"message"
}
}
output {
stdout {codec =>rubydebug}
}

 

grok filter

gork 是目前logstash里最好的一种解析各种非结构化的日志数据的工具
官方的patterns地址:

https://github.com/logstash-plugins/logstash-patterns-core/tree/master/patterns
https://github.com/logstash-plugin/logstash-patterns-core/blob/master/patterns/grok-patterns


grok的例子:
input {
file {
path => "/var/log/nginx.log"
type => "nginx"
start_postion => "beginning"
}
}

filter {
grok {
match =>["message","%{IP:ip} %{WORD:method}.......%{NUMBER:duration}"]
}
}

output {
stdout {codec =>rubydebug}
}

 

filter

原文:http://www.cnblogs.com/smail-bao/p/5693554.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!