配置文件內容:
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進程,重新運行一下,才能生效。
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!" } }