如何读取 Logstash 输入的 gzip json



for json,

我可以使用

input {
  tcp {
    codec => json
  }
}

对于压缩的内容,

我可以使用

input {
  tcp {
    codec => gzip_lines
  }
}

如何读取 gzip 的 json 输入?

我的输入是通过网络,而不是文件...

您需要

安装gzip_lines插件并使用更高版本的 ELASTIC Stack。

命令 bin/logstash-plugin install logstash-codec-gzip_lines

请参阅随附的示例配置文件

input {
  file {
     type => "gzip"
     path => "/Users/sonupajai/Desktop/workspace/data/logs*.gz"
     mode => "read"
     file_completed_action => "log"
     file_completed_log_path => "/Users/sonupajai/Desktop/workspace/data/log.txt"
  }
}
filter {
    json {
        source => "message"
        target => "message"
    }
}
output {
    elasticsearch { 
    hosts => ["localhost:9200"]
    index => "json-log2-%{+YYYY.MM.dd}"
  }
}

最新更新