Logstash—Codec模块
1.rubydebug
标准输出到shell程序控制台
Codec {
rubydebug {
metadata:是否包含元数据
}
}
##########################################
Codec {
rubydebug {
metadata=>true
}
}2.json
解码基于json的数据
Codec {
json {
charset:字符编码
}
}
##########################################
Codec {
json {
charset=>"UTF-8-MAC"
}
}3.avro
基于avro格式的输入数据进行编解码
Codec {
avro {
schema_uri:设定模式文件,avro从中读取数据
}
}
##########################################
Codec {
avro {
schema_uri=>"/usr/share/logstash/input-schema.avsc"
}
}4.multiline
多个事件合并为一个
Codec {
multiline {
pattern:设置匹配模式
what:previous或next,定义匹配模式作为前面事件还时后面事件
auto_flush_interval:时间间隔
charset:字符集编码
max_lines:最大文件行数
multiline_tag:向multiline增加tag
negate:确定event是否是mutiline事件的一部分
patters_dir:设定自定义模式存放的文件夹
}
}
##########################################
Codec {
multiline {
multiline_tag=>"multiline-event"
pattern=>"^\["
negate=>"true"
what=>"next"
}
}
天道酬勤 循序渐进 技压群雄
浙公网安备 33010602011771号