日志文件不会出现在弹性搜索中

Logfile won't apear in elasticsearch

我是 logstash 和 elasticsearch 的新手,我正在尝试以我可以的方式将我的第一个日志存储到 logstash(如果不是目的,请纠正我)使用 elasticsearch 搜索它....

我的日志基本上是这样的:

2016-12-18 10:16:55,404 - INFO - flowManager.py - loading metadata xml

因此,我创建了一个如下所示的配置文件 test.conf:

input {
  file {
    path => "/home/usr/tmp/logs/mylog.log"
    type => "test-type"
    id => "NEWTRY"
 }
}
filter {
  grok {
    match => { "message" => "%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{HOUR:hour}:%{MINUTE:minute}:%{SECOND:second} - %{LOGLEVEL:level} - %{WORD:scriptName}.%{WORD:scriptEND} - " }
  }
}
output {
  elasticsearch {
    hosts =>  ["localhost:9200"]
    index => "ecommerce"
    codec => line { format => "%{year}-%{month}-%{day} %{hour}:%{minute}:%{second} - %{level} - %{scriptName}.%{scriptEND} - \"%{message}\"" }
  }
}

然后:./bin/logstash -f test.conf

当我转到:http://localhost:9200/ecommercehttp://localhost:9200/ecommerce/test-type/NEWTRY

时,我没有看到弹性搜索中的日志

请告诉我我做错了什么.... :\

谢谢, 希瑟

我最终找到了解决方案-

我将 sincedb_path=>"/dev/null"(据我了解仅用于测试环境)和 start_position => "beginning" 添加到输出文件插件中,文件同时出现在 elastic 和 kibana 中

感谢您的回复和帮助!