When the specified option is enabled it will save a compressed archive for each month's raw access logs into the "logs" sub-directory of the cPanel user account's home directory path (e.g., within "/home/username/logs/"). The current implementation of archiving is on a monthly basis but keeps the current month updated automatically after each stats processing run. It is not currently possible to set a number of days instead of the per-month behavior. However, it is possible to setup new cPanel accounts where the access log archiving option is enabled (i.e., turned-on) by-default; this can be accomplished by using the cPanel skeleton directory structure that is available to both root (i.e., server administrators) and resellers.
Originally Posted by Vliegtuig
I recommend reviewing the following posts for additional examples and clarification:
Using the cPanel skeleton directory you may setup custom files and directory structure that will be installed in the unique home directory of new cPanel user accounts; for example, you may setup a file to store the default preference for monthly archiving of Raw Access Logs.
To view where your specific skeleton directory is located, simply access the following WHM menu path:
WHM: Main >> Account Functions >> Skeleton Directory
- If you're logged-in as root, it should display the following directory path:
- If you're logged-in as a reseller, it will display a path within your reseller user home directory, similar to the following (where "username" would be your reseller or WHM login username):
As an example, if you wanted to setup access log archiving by default but also have the previous month's archive removed (cleaned) to save space, the following could be entered into a new file using only plain-text without any special fonts or formatting:
The above contents should be saved into a file named ".cpanel-logs" and setup in a location like one of the following examples:
- If you have root access to WHM, the file would be setup here:
- If you have reseller access to WHM, the file would be setup relative to the home directory path of the logged-in reseller user:
To apply the change preference existing accounts, either of the following methods may be used:
- Setup while logged-into the desired cPanel account: cPanel: Main >> Logs >> Raw Access Logs >> Configure Logs
- Setup while logged-into SSH as root (i.e., as the server administrator): The file named ".cpanel-logs" may be duplicated (copied) into the user home directory of any cPanel accounts that need it enabled. This systems administration task is best performed via command-line SSH access while ensuring to set both proper (chmod) access permissions as well as to ensure correct file ownership, to match the applicable cPanel account username. Here is a basic example of how to copy the file and set permissions and ownership via root SSH access; in the commands shown please note that "username" should be replaced by that of the desired cPanel account login username:
# cp -v /root/cpanel3-skel/.cpanel-logs /home/username/.cpanel-logs
# chown -vv username:username /home/username/.cpanel-logs
# chmod -vv 0600 /home/username/.cpanel-logs
Moderator Note: This thread is being closed as it is for a feature that is currently available via existing functionality, that of having archival of domain raw access logs automatically enabled for new user accounts via the cPanel skeleton directory.