2017-01-21 12 views
1

ファイルを1行ずつ読み込み、行だけをキューに入れたいとします。 プロセスは機能しますが、キューにはバージョンなどの情報がたくさんあります。Logstashはメッセージの内容のみを取得します

ご存知ですか?これは私のテストの行です :EXAMPLE.SQLのは含まれてい

input { 
    file { 
    codec => plain 
    path => "/apps/*.txt" 
    } 
} 
filter{ 

} 
output { 
    stomp { 
     host => "localhost" 
     port => "61613" 
     destination => "stomp-test" 
     debug => "true" 
     headers => { 
       "amq-msg-type" => "text" 
       "my_custom_header" => "kutya" 
     } 
    } 
} 

は、ここに私の設定ファイルであります!

MQ本体には次のものが含まれています: {"メッセージ": "これは私のテスト行です"、 "@ version": "1"、 "@ timestamp": "2017-01-21T13:42:21.084Z" 、 "path": "/ apps/1.txt"、 "host": "ol7"}

私の期待する結果は次のとおりです。 これは私のテスト行です!

ありがとうございます。あなたができる最善を使用して他のすべてのフィールドを削除することです

t.send(event.sprintf(@destination), event.to_json, headers) 
             ^
              | 
            writes JSON 

:それが現在立っているように、そのプラグインのin the source code見ることができるように

答えて

1

stomp出力は、唯一の宛先キューにJSONを書きます

filter { 
    mutate { 
    remove_field => ["@timestamp", "@version", "path", "host"] 
    } 
} 

次に、あなたがあなたの宛先キューにのみ、これを取得します:

{"message":"This is my test row!"} 
このような mutate/remove_field filter
関連する問題