Logstash 7.9 的 INPUT 方法中的 File 来源可以指定 gzip压缩包读取,但是目前只支持 read 方法(一次把文件从头读到EOF)
input {
file {
path => [ "/d1/log2load/*/*" ]
mode => "read"
file_completed_action => "log"
file_completed_log_path => "/d1/logstash/readcompleted.log"
}
}
output {
stdout { codec => json }
}
配置后可以读取,但是生成的message字段都是乱码
查了很多资料,最后找到一个资料,logstash 从 gzip 压缩包中处理日志,对文件名有要求,需要是 gzip 或者 gz 文件后缀