日志和格罗克过滤器故障



我的日志文件只有一行(取自教程日志文件):

55.3.244.1 GET /index.html 15824 0.043 

我的 conf 文件看起来像这样:

input {
  file {
    path => "../http.log"
    type => "http"
  }
}
filter {
  grok {
    type => "http"
    match => [ "message", "%{IP:client}" ]
  }
}

我用 grok 调试器测试了我的 grok 过滤器,它工作了。我不知所措,不知道自己做错了什么。我每次都得到[0]"_grokparsefailure"

就调试 grok 过滤器而言,您可以使用此链接 (http://grokdebug.herokuapp.com/) 它有一个非常全面的模式检测器,这是一个良好的开端。

如果您只关心 IP 而不关心日志消息的其余部分,则以下过滤器应该适合您。

%{IP:host} %{GREEDYDATA:remaining_data}

最好的调试方法是使用、stdinstdout插件进行 logstash 和调试grok模式。

您可以在此处找到文档http://logstash.net/docs/1.4.2/

最新更新