How to Download Raw Access Logs In cPanel

In this tutorial, I will show you how to download your website’s raw access logs from cPanel and extract to view them. We’ll talk about archiving the logs and how long to keep archives.

Most web servers keep a record of requests for resources like pages, images, javascript, CSS, etc. Any time a visitor requests a file, the IP address of the visitor and the file they requested (along with a lot of other information) is recorded.

The resulting lists of all of the requests are called “raw logs” or “access logs.”

The raw logs are text files with one line for each request:

what the raw logs look like

That’s what they call a solid block of text. But it’s also full of information.

Most of us interpret the logs using a stats program like Webalizer or AWStats. But the raw logs can be useful for finding abuse patterns and a myriad of other information that a stats program doesn’t provide.

cPanel makes downloading the raw logs easy.

Finding Your Website’s Raw Access Logs in cPanel

Click the “Raw Access” link or icon

click the “Raw Access” link or icon in cPanel

In the “Configure Logs” section, there are two options:

  • Archive log files to your home directory after the system processes statistics.
  • Remove the previous month’s archived logs from your home directory at the end of each month.

Both options may already be selected by default. If that’s the case, you can download logs immediately. If the “Archive log files” option is not selected, check the box and click the “Save” button.

if the "Archive log files" option is not selected, check the box and click the “Save” button

The system processes access logs every 24 hours. So if you had to activate log archiving, you will have to wait at least 24 hours to download the raw logs.

Downloading Raw Access Logs

If log archiving was already selected, you can download your access logs right away.

In the “Download Current Raw Access Logs” section, click the domain name to download the raw logs for that domain.

click the domain name to download the raw logs

The logs are zipped as .gz archives so you will need an unzipping program such as 7-Zip or WinZip to extract the log file.

Once extracted, you can open the file in any text editor.

Downloading Archived Raw Logs

You can download access logs from the archive in the same way.

Click the name of the archive you’d like to download. Unzip and open in your text editor.

click the name of the archive you'd like to download

How Long Should Logs Be Retained?

In the “Configure Logs” section, you have the option to “Remove the previous month’s archived logs from your home directory at the end of each month.” If you check this option, the system will archive raw logs for a month.

If you need to keep more than one month of raw logs, uncheck the option and click the “Save” button.

uncheck the option and click the "Save" button

Use caution. If you run a busy site, the raw access logs can become quite large. The system saves logs in your home directory. So in many cases, the size of the logs will count against your website storage space quota.

If you do choose to retain logs, be sure to keep an eye on the amount of space they use and delete as necessary.

Have you ever taken a look at your raw logs? If you retain logs, how many months do you typically keep?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.