2016-12-08 9 views
1

私は、複数のタイプのログをビートで送信し、それらをlogstashサーバで解析しようとしています。Logstashビート入力 - 複数のマルチラインコーデック

私はビートを正しく設定して動作しており、ほぼ正常に動作しています。

問題が発生しているのは、other-log.logに異なる形式の文字列で始まるエントリがあることです。

私は理想的な世界では、のエントリに応じて異なるmultilineコーデックを適用したいと考えています。

しかし私は、私の推測では、ifinputブロック内で許可されていないということです、logstashが失敗する原因となる

 if [type] == "server.log" { 
      codec => multiline { 
        pattern => "^\d{2}:\d{2}:\d{2},\d+" 
        negate => true 
        what => "previous" 
      } 
     } 

を試してみました。

私もmultilineフィルタ・プラグインを使用しようとしましたが、それは

"Couldn't find any filter plugin named 'multiline'. Are you sure this is correct? Trying to load the multiline filter plugin resulted in this error: LoadError"

になり、誰もがこの仕事をするためにどのようにとの考えを持っていますか?

filebeat.yml

- input_type: log 
    paths: 
    - /application/server.log 
    document_type: server.log 
- input_type: log 
    paths: 
    - /tmp/other-log.log 
    document_type: other.log 

pipeline.conf

input { 
    beats { 
     host => "0.0.0.0" 
     port => "5044" 
     codec => multiline { 
       pattern => "^\d{2}:\d{2}:\d{2},\d+" 
       negate => true 
       what => "previous" 
     } 
    } 
} 
filter { 
     if [type] == "server.log" { 
       grok { 
         match => { "message" => "(?<date>^\d{2}:\d{2}:\d{2},\d+)\s(?<level>[A-Z]+)\s+\[(?<class>.*?)\]\s+(?<message>(?m).*)" } 
         overwrite => ["message"] 
         add_tag => [ "server.log" ] 
       } 
     } 
} 
# The filter part of this file is commented out to indicate that it is 
# optional. 
# filter { 
# 
# } 
output { 
     elasticsearch { hosts => ["localhost:9200"] } 
} 

答えて

2

私はfilebeat.ymlに複数行を移動し、それは私の問題を解決:)

関連する問題