Linux Configure Logwatch on the Central Log Server

Logwatch is a tool that analyzes and summarizes system logs, and can be used to monitor system activity on a central log server. Here are the basic steps for configuring Logwatch on a central log server:

  1. Install the Logwatch package on your central log server. On most Linux distributions, you can do this using the package manager. For example, on a CentOS or Red Hat system, you can run the following command:
sudo yum install logwatch
  1. Configure Logwatch to run as a daily cron job. This will ensure that the system logs are analyzed and summarized on a regular basis. To do this, create a new file in the /etc/cron.daily/ directory. For example, you can run the following command to create a new file named logwatch:
sudo nano /etc/cron.daily/logwatch
  1. In the new file, add the following command to run Logwatch with the appropriate options:
/usr/sbin/logwatch --output mail --mailto you@example.com --detail high

This command specifies that Logwatch should send the summary report via email to the address you@example.com, and that it should include detailed information about high-priority events.

  1. Save the file and exit the text editor.
  2. To ensure that the email notifications are sent successfully, configure your system’s email settings, including the SMTP server and authentication credentials. For example, you can use the mailx command to test the email settings. For example, to send a test email, you can run the following command:
echo "Test message" | mailx -s "Test subject" you@example.com
  1. Once you have confirmed that the email settings are correct, wait for the daily cron job to run, or run it manually to generate a Logwatch summary report. You can then review the report to identify any issues or anomalies in the system logs.

Note that these are just basic steps for configuring Logwatch on a central log server, and there are many more advanced configurations and options available. Consult the Logwatch documentation and your system’s documentation for more information.

Leave a Comment