Install Logwatch on Centos7 and use the msmtp mail client to send server monitoring and analysis logs

Source: Internet
Author: User

Install Logwatch on Centos7 and use the msmtp mail client to send server monitoring and analysis logs

###########################

# DATE 2016-07-29 #

# Authur by Denilas Yeung #

###########################

1. Install msmtp

Download msmtp: http://jaist.dl.sourceforge.net/project/msmtp/msmtp/1.6.5/msmtp-1.6.5.tar.xz

Because the file format is xz, the decompression method is:

# Xz-d msmtp-1.6.5.tar.xz

# Tar xvf msmtp-1.6.5.tar

# Cd msmtp-1.6.5

#./Configure -- prefix =/user/local/msmtp

# Make

# Make install

#/Usr/local/msmtp/bin/msmtp-P # Check the path of the configuration file. The configuration file for Centos7 is created under/usr/local/etc, centos6.x create an msmtprc file under/usr/local/msmtp/etc/

# Vi/usr/local/etc/msmtprc

Account accountname

Logfile/usr/local/msmtp. log

Host smtp.xxx.com

Port 25

From xxx@xxx.com

Auth login

Tls off

User xxx@xxx.com

Password

Account default: accountname

# Save and exit

#/Usr/local/msmtp/bin/msmtp xxx@xxx.com # test whether mail can be sent

Now, msmtp configuration is complete.

######################################## ######################################## #########

Ii. install and configure logwatch

# Yum-y install logwatch

# Whereis logwatch # view the default configuration file/usr/share/logwatch/default. conf in the system folders after logwatch is installed.

# Vi/usr/share/logwatch/default. conf/logwatch. conf # modify the following parameters:

MailTo = Email address of the recipient

MailFrom = who sent

Detail = Low ro Med or High # details of the System Log Analysis Report: simple, moderate, and detailed

Mailer = "/usr/local/msmtp/bin/msmtp-t" # The default value is sendmail, Which is changed to the msmtp path.

# Save and exit

#/Usr/share/logwatch/scripts/logwatch. pl -- mailto xxx@xxx.com # test whether the current system log analysis report is sent to a xxx@xxx.com email and check whether it is received. By default, the system sends the report of the previous day, which can be modified in the configuration file.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.