Various Log File scripts

Here you will find various logfile scripts to add to WHM. You can look at several different log files, check the log file sizes, and even empty various log files, all from within WHM with a simple addon script. There's even one that allows you to have a cron job automatically empty various log files.

April 29, 2008 - The "View (and search) Log Files" script has been improved.

You can scroll down the page or use these links to go to the script you want.

- view (and search) log files (file contents)
- view log file sizes
- empty log files
- auto empty log files

be sure to upload the scripts in ascii mode


view (and search) log files script

Script to view (and search) various log files from WHM: addon_PWSviewlogfiles V7.0
  Created - in 2003 (V1.0)
  Modified - March 2, 2004 (V2.0)
        combined seperate view log file scripts into one
        edited to be easily modified and used by others
  Modified - March 2, 2004 (V2.01)
        added warning at start of actual code
  Modified - August 13, 2004 (V3.0)
        Full redesign of processes and options
  Modified - September 12, 2004 (V3.01)
        changed sample WHM link to match the X theme
  Modified - January 16, 2005 (V3.1)
        By Blogs-About.com
        added the ability for form input to grep results prior to display
        (a big thanks for this useful addition)
  Modified - January 27, 2005 (V3.2)
        added apache domlogs to the logs to view
  Modified - December 30, 2005 (V3.3)
        modified to be a WHM addon script
          (no customization is needed to the WHM skin)
  Modified - February 28, 2006 (V4.0)
        minor change to search method
        added multiple search fields with options for each
  Modified - March 1, 2006 (V4.5)
        added ability to prevent resellers from seeing other users domain log files
  Modified - April 4, 2006 (V4.51)
        spelling errors, code cleanup, and notes (nothing affecting script itself)
  Modified - September 19, 2006 (V5.0)
        added auto refresh option
  Modified - November 4, 2006 (V6.0)
        added option to allow only users with root access to use this script
  Last Modified - April 28, 2008 (V7.0)
        added ability to search multiple domlog files at once
        added option to skip listing bytes_log and ftp_log files from domlogs directory
            (drastically reduce the domlog list for servers with many accounts)
        added javascript function to select multiple domlog options

This script allows you to view (and search) the contents of various log files from WHM. The log files handled by this script are the Apache logs and domlogs, cpanel logs, and some of the logs in the /var/logs directory. Full instructions on setting up and using this script are included in the script.

Save the script file to your WHM's cgi directory, which should be at /usr/local/cpanel/whostmgr/docroot/cgi. Rename the file to addon_PWSviewlogfiles.cgi and make it executable. Specify the paths to your log files in the script, and it will automatically be in your WHM theme.

"Scripts Club" members know where to find the script.


view log file sizes script

Script to view various log file sizes from WHM: addon_PWSviewlogfilesizes V3.5
  Created - in 2003 (V1.0)
  Modified - March 6, 2004 (V2.0)
        edited to be easily modified and used by others
  Modified - September 12, 2004 (V2.01)
        changed sample WHM link to match the X theme
  Modified - January 29, 2005 (V3.0)
        changed method of generating output to work properly on most setups
        added choice of output format
  Last Modified - April 4, 2006 (V3.5)
        modified to be a WHM addon script
          (no customization is needed to the WHM skin)
        added multiple sort options

This script will give you a listing of all your apache, cpanel, and var/log, log files to give you a quick look at the sizes of them without having to go to shell. It now has the option to list Alphabetically, By Size, By Modification Time, or By File Extension.

Save the script file to your WHM's cgi directory, which should be at /usr/local/cpanel/whostmgr/docroot/cgi. Rename the file to addon_PWSviewlogfiles.cgi and make it executable. Specify the paths to your log files in the script, and it will automatically be in your WHM theme.

"Scripts Club" members know where to find the script.


empty log files script

Script to empty various log files from WHM: addon_PWSemptylogfiles V2.1
  Created - June 19, 2004 (V1.0)
  Modified - June 20, 2004 (V1.5)
        added ability to choose whether to compress or delete old log files
        added ability to delete old compressed log files created by this script
  Modified - September 12, 2004 (V1.51)
        changed sample WHM link to match the X theme
  Modified - January 16, 2005 (V2.0)
        added ability to empty various cpanel logs
  Last Modified - April 4, 2006 (V2.1)
        modified to be a WHM addon script
          (no customization is needed to the WHM skin)

This script allows you to empty log files of your choice. It even restarts cpanel or apache as needed.

Save the script file to your WHM's cgi directory, which should be at /usr/local/cpanel/whostmgr/docroot/cgi. Rename the file to addon_PWSemptylogfiles.cgi and make it executable. Specify the paths to your log files in the script, and it will automatically be in your WHM theme.

"Scripts Club" members know where to find the script.

auto empty log files script

Script to automatically empty log files via cron job: PWSautoemptylogfiles V2.5
  Created - January 9, 2005 (V1.0)
  Modified - January 9, 2005 (V1.1)
        added /var/log/chkservd.log file to options to empty
  Modified - January 15, 2005 (V2.0)
        added cpanel logs to options to empty(*)
  Last Modified - January 16, 2005 (V2.5)
        final adjustments before going public
(*) feature not in free version

This script allows you to set a cron job to automatically empty various log files at your own time and frequency. It even restarts various services as needed.

Save the following file to just about anywhere you want on your server, set a few variables, then set a cron job to run it when you want.

auto empty log files script V2.5free - rename to PWSautoemptylogfiles
"Scripts Club" members know where to find the "added features" version.


Custom Scripts main page

Scripts Club
for a small donation you get access to the WHM scripts and improved versions of other scripts,
as well as other luxuries of being a "Scripts Club" member.

Go Back