2016-01-13 95 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