Friday, September 27, 2013

How to install Logwatch on cPanel servers running CentOS 6

Logwatch isn't included by default in CentOS 6 & cPanel installs. You can install it manually by following these instructions:
  1. Go get the latest version of logwatch by going to: http://sourceforge.net/projects/logwatch/
    Make sure you download the NOARCH rpm file.
  2. Log into your cPanel server, and run the command as root or with appropriate sudo permissions:
    $ rpm -Uvh logwatch-7.3.6-1.noarch.rpm
  3. Now you need to edit the logwatch.conf file to add some lines to get it working:
    $ nano -w /usr/share/logwatch/default.conf/logwatch.conf
  4. Add the following lines after tmpdir = /var/cache/logwatch:
    #Output/Format Options
    #By default Logwatch will print to stdout in text with no encoding.
    #To make email Default set Output = mail to save to file set Output = file
    Output = mail
    #To make Html the default formatting Format = html
    Format = text
    #To make Base64 [aka uuencode] Encode = base64
    Encode = 0
  5. Save the file.
That is it. You can test your changes immediately by running the following command or wait until the daily cronjob is run.
$ perl /etc/cron.daily/0logwatch > /root/output.txt
$ less /root/output

No comments:

Post a Comment