[[Email protected] etc]# cat plat_interface_info.conf input { file { type => "234_plat_inter_info_log" path => ["/opt/log/plat_inter_info.*.log"] codec=> "JSON" }}filter {if [type] == "234_plat_inter_info_log" { if [level] == "ERROR" { mutate { add_tag => "Email" } } }}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 } if " Email " in [tags] { email { port => " address " => "Smtp.exmail.qq.com" username => " [Email protected] " password => "******" authentication => "plain" use_ tls => false from => "[email protected]" subject => "waring: you have an error on host 192.168.1.234" to => "[email protected], [email protected], [ Email protected], [email protected] " via => "SMTP" body => "you hava an error of plat_inter_error! server_ip:192.168.1.234 \n error time: %{@timestamp}+08:00hours ; \n error message: %{message} ; \n logger name: %{logger_name}; \n level:%{level} ; \n level_value:%{level_value} ; \n Stack_trace : \n %{stack_trace}\n " } }
Open Kibana found that the email tag has been hit and sent a message:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/E2/wKioL1cxO_PTxd_oAABSgKCnv20576.png "title=" Email.png "alt=" Wkiol1cxo_ptxd_oaabsgkcnv20576.png "/>
This article is from the "clear" blog, make sure to keep this source http://duanyexuanmu.blog.51cto.com/1010786/1771664
Elk-json Log-Special field error field alarm configuration file