Are you still manually checking logs when installing Logwatch? Then you are OUT. Now Logwatch has been able to customize an exclusive log push for you, eliminating the hassle of manually viewing logs, saving administrators time and energy. Logwatch, as its name implies, is a software dedicated to monitoring log files. After installation, you can send the host log analysis file to the specified mailbox every day. Logs can be accurately received every day (or even more frequently. To the server
Prepare and install Logwatch
Are you still manually viewing logs one by one? Then you are OUT. Now Logwatch has been able to customize an exclusive log push for you, eliminating the hassle of manually viewing logs, saving administrators time and energy.
Logwatch, as its name implies, is a software dedicated to monitoring log files. After installation, you can send the host log analysis file to the specified mailbox every day. Logs can be accurately received every day (or even more frequently. In this way, you can understand the security of your servers.
Today, we will briefly introduce how to install and configure Logwatch on Ubuntu 15.04.
Preparations before installation
Because the reports collected by Logwatch need to be pushed through your email, you need to confirm whether the email address works properly before installation.
The general operating system will bring this package. Then you can start Ubuntu, log on with the root user permission, and then upgrade the system software installation package.
Root @ ubuntu-15 :~ # Apt-get update
Install Logwatch
After updating the software installation package, all preparations have been completed. Then you can install Logwatch.
Root @ ubuntu-15 :~ # Apt-get install logwatch
Once you select "Y", Logwatch will install some additional software during the installation process.
During the installation process, you will be prompted to set your Postfix configuration based on your email server. In the image below, select "Local only" (Local only ). Then select OK.
Then you must select your email server Name, which should have a Fully Qualified Domain Name (FQDN: Fully Qualified Domain Name ).
After the Postfix is configured, select OK to install Logwatch through the default Postfix settings.
You can enter the following settings in the terminal to check the Logwatch status.
Root @ ubuntu-15 :~ # Service postfix status
To check whether Logwatch is installed by default, enter a single "logwatch.
2. Configure Logwatch
Root @ ubuntu-15 :~ # Logwatch
Configure Logwatch
After Locwatch is successfully installed, we need to make simple settings for Logwatch. So let's use the file editor to configure the new Logwatch.
Root @ ubuntu-15 :~ # Vim/usr/share/logwatch/default. conf/logwatch. conf
Input and Output options
To set "Output = mail" to "Output = file" by default, you can set it as needed.
Output = stdout
If you are using the web mail configuration, you can update the default Html format and enter
Format = text
Add an email account to send the log information of the Logwatch mobile phone. As input
MailTo = root
# MailTo = user@test.com
The default email address can be a local account or any other account you want to set.
# Complete email address.
MailFrom = Logwatch
Save the settings.
Configure Cronjob
Now edit "00 logwatch" under the daily crons directory"
Root @ ubuntu-15 :~ # Vim/etc/cron. daily/00 logwatch
Here you need to use the "-- mailto" user@test.com to replace the output mailbox and save the file. (For example)
Logwatch report
Enter the "logwatch" command in the terminal to obtain the result.
Root @ ubuntu-15 :~ # Logwatch
The execution date and time of the generated report are displayed first. For example
3. More information about Logwatch
The following shows all installed software packages in the system.
The Logwatch report displays the security log and the disk space usage in the root directory.
You can also run the following command to check the emails generated by Logwatch.
Root @ ubuntu-15 :~ # Vim/var/mail/root
More commands you may use
If you want to read all the Logwatch manual information, you can enter the following command. If you want to read the manual, simply press "Q ".
Root @ ubuntu-15 :~ # Man logwatch
If you want to obtain the usage and details of more Logwatch commands, you can enter:
Root @ ubuntu-15 :~ # Logwatch-help
Conclusion
Logwatch, as a server logging mobile phone expert, do you fall in love with him? If you have one, please do it quickly! The installation and configuration are all done, so the boss no longer has to worry about checking my logs.
Use logwatch monitoring Log File http://www.linuxidc.com/Linux/2014-12/110703.htm in Linux
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-08/122506.htm