logstash邮件报警功能实现


配置文件内容:

input {
    stdin {
         }
    }
output {
    email {
        port           =>    "25"
        address        =>    "smtp.qq.com"
        username       =>    "[email protected]"
        password       =>    "*********"
        authentication =>    "plain"
        use_tls        =>    false
        from           =>    "[email protected]"
        subject        =>    "Warning: you have an error!"
        to             =>    "[email protected]"
        via            =>    "smtp"
        body           =>    "you hava an error!"
        }
}

见附件



========================================================================================


2.群发邮件功能的实现

注意,配置文件加入邮箱后,记得kill掉 logstash进程,重新运行一下,才能生效。

logstash邮件报警功能实现_第1张图片

input {

  file {
    type => "192.168.1.234_plat_inter_error_log"
    path => ["/opt/log/plat_inter_error.*.log"]
    start_position => "beginning"
  }
}

output {
    elasticsearch {
        hosts => ["192.168.1.108:9200"]
        index => "logstash-%{type}-%{+YYYY.MM.dd}"
        document_type => "%{type}"
        workers => 1
        flush_size => 20000
        idle_flush_time => 10
        template_overwrite => true
    }

    email {
        port           =>    "25"
        address        =>    "smtp.qq.com"
        username       =>    "[email protected]"
        password       =>    "qugbpxrclkvdbfcg"
        authentication =>    "plain"
        use_tls        =>    false
        from           =>    "[email protected]"
        subject        =>    "Warning: you have an error!"
        to             =>    "[email protected][email protected][email protected][email protected][email protected]"
        via            =>    "smtp"
        body           =>    "you hava an error of plat_inter_error!"
    }

}


你可能感兴趣的:(logstash,邮件报警)