如何使用logstash从日志文件中读取特定行

时间:2017-06-21 10:22:36

标签: elastic-stack

我必须根据某些文本从日志文件中读取3个不同的行,然后输出csv文件中的字段。

sample log data:-

20110607 095826 [.] !! Begin test. Script filename/text.txt
20110607 095826 [.] Full path: filename/test/text.txt
20110607 095828 [.] FAILED: Test Failed()..

i have to read file name after !!Begin test. Script. this is my conf file
   filter{
       grok
        {
        match => {"message" => "%{BASE10NUM:Date}%{SPACE:pat}{BASE10NUM:Number}%
                  {SPACE:pat}[.]%{SPACE:pat}%{SPACE:pat}!! Begin test. Script%
                  {SPACE:pat}%{GREEDYDATA:file}"
                 }
        overwrite => ["message"]
        }

        if "_grokparserfailure" in [tags]
        {
        drop{}
        }
        }

but its not giving me single record, its parsing full log file in json format no parsed field.

0 个答案:

没有答案