Today we are going to see how to configure a linux server. However, when you have more than one, it’s not practical to have to manually connect to SSH on the server and go one by one to explore the log files. Logwatch will allow us to automate all this and receive reports directly by mail !
Logwatch allows you to receive an email report each day from the various server logs. If this is manageable when you administer only a few, a powerful monitoring solution will quickly save you when the number of machine you manage will increase. It is more flexible, more pro and more efficient … And then between us, emails, we already get too much!
If not already done, we install a mail server so that our server can send mails (so please?!) To send us reports on its activities. It is the same mail server that also allows a website to send emails via PHP for example.
We then install logwatch, which will allow us to have a daily report of the activity of the server by email:
Apt - get install logwatch
Then we’ll set it up. Configuring here is a great word since there is not much to set up. Two of them will be dealt with: the email address to which the reports will be sent and the level of detail of the reports. The level of detail ranges from 0 to 10, where 0 is the least and 10 the most detailed … I advise to do a test with 5 and adjust according to what you desire. The conf file is located at
Nano / usr / share / logwatch / default . Conf / logwatch . conf # We will modify the following lines # The email address where the reports are sent: # Default person to mail reports to. Can be a local account or a # complete email address. Variable Output should be set to mail, or # --output mail should be passed on. MailTo = address @ domain . tld # You notice that the e-mail address can be a local address (root as by default, for example) # And here the detail level of the report: # The default detail level for the report. # This can be either Low, Med, High or a number. # Low = 0 # Med = 5 # High = 10 Detail = 5
That’s all for Logwatch, you now have a detailed report every morning about your servers activity. Nothing will escape you anymore!