ELK study notes (3) [original]

Logstash is very convenient to collect logs, and it has a powerful function, that is, it can send email reminders, which is very helpful for our log monitoring. With it, we can discover the running status of the online system in real time. This article describes the installation and use of the log plugin.
1. Download the plugin logstash-output-email v4.0.3
2. Unzip
  
tar -xvf v4.0.3

3. Modify the installation plugin script bin/logstash-plugin, add the header
  
export JAVA_HOME=/usr/local/jdk1.8.0_121
export PATH=$JAVA_HOME/bin:$PATH
   

4. Modify the installation plugin configuration file vim Gemfile, add at the end
gem "logstash-output-email", :path => "/usr/local/logstash-output-email-4.0.3"

5. Install the plugin
bin/logstash-plugin install logstash-output-email


6. Modify the logstash configuration file bin/logstash_gateway.conf, add in output
if [level] == 'ERROR' {
		email {
	      address        =>    "mail.zjport.gov.cn"
	      username       =>    "username"
	      password       =>    "password"
	      from           =>    "[email protected]"
	      subject        =>    "ERROR: Gateway error %{datetime}"
	      to             =>    "[email protected]"
	      body           =>    "%{message}"
	  }
	}

7. When the error log is captured, logstash automatically sends an email

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326507299&siteId=291194637