2016-01-13 89 views
0

我在docker中使用了elk(elasticsearch,logstash和kibana)。在logstash中,我有input.conf和output.conf。所有工作正常,但我不添加任何grok过滤器。如果我尝试将其添加到input.conf或创建新文件“filter.conf”,但logstash没有看到这些过滤器。未检测到Logstash过滤器配置

我input.conf中

input { 
    file { 
     type => "test" 
     path => [ 
      "/host/var/log/test.log" 
      ] 
    } 
} 

我output.conf

output { 
    elasticsearch { 
     hosts => ["localhost"] 
    } 
} 

我的过滤器:

filter { 
    grok { 
    type => "test" 
    match => [ "%{IP:client}, "%{WORD:method}", "%{URIPATHPARAM:request}", "%{NUMBER:bytes}", "%{NUMBER:duration}" ] 

} 
} 

日志的实施例,这是在保存test.log中:回波51.0 .50.1 POST /index.html 15824 0.049 >> var/log/test.log

这个配置有什么问题?

+0

“看不到”?你的意思是你不会以'客户','请求'(等)字段或? –

回答

0

没有很好地形成你神交模式,它应该像下面,即与在开始和结束一个双引号,没有逗号:

filter { 
    grok { 
    match => { "message" => "%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}" } 
} 
} 

使用过滤器,您的样本日志行51.0.50.1 POST /index.html 15824 0.049,我看到下面的事件似乎是正确的:

{ 
     "message" => "51.0.50.1 POST /index.html 15824 0.049", 
     "@version" => "1", 
    "@timestamp" => "2016-01-13T17:07:15.274Z", 
      "host" => "iMac.local", 
     "client" => "51.0.50.1", 
     "method" => "POST", 
     "request" => "/index.html", 
     "bytes" => "15824", 
     "duration" => "0.049" 
} 
+0

你能试试吗? – Val