如果日志存储配置文件中的模式匹配,如何停止读取日志文件?

时间:2019-10-30 09:24:41

标签: logstash elastic-stack logstash-grok logstash-configuration kibana-7

---我有一个日志存储配置文件。

---当模式匹配时,我需要停止读取日志文件。    当我解决该模式(错误)并更新日志文件时。

---然后它需要从最后一个读取点开始读取文件

---我可以使用if语句吗?如果是,怎么办?    命令停止在if语句里面?

Here is the code :

  input
 {


      file 
    {
        path => "C:/ELK-Stack/log files/sap.log"
type => "log"
start_position => "beginning"
sincedb_path => "C:\ELK-Stack\LG\logstash\data\plugins\inputs\file\.sincedb"
sincedb_write_interval => 60
      }
 }



filter 
{
    grok
{
  match => [
      "message",
      "%{TIMESTAMP_ISO8601:logsimestamp}%{SPACE}%{WORD:type}%{SPACE}\[%{DATA:ERROR}\]%{SPACE}%{INT:INT}:%{WORD:type2}%{SPACE}%{WORD:type3}%{SPACE}%{WORD:type4}"
    ]

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

 if "2000023" in [INT]
{
 mutate 
    {
      add_tag => ["countthetimes"]
}
}
 }

0 个答案:

没有答案
相关问题