X
  1. Home
  2. cPanel/WHM
  3. Where can I find access logs for my websites?

Where can I find access logs for my websites?

When troubleshooting, sometimes the access logs created by the server based on traffic towards a certain website may be handy. This guide will show you a few different ways to reach those logs, and will also tell you how to activate archiving of logs so you can access them for a longer period of time.

Accessing the logs

You may access your logs by two different means; either via cPanel for the web hosting account, or via SSH.

Via cPanel

To access the logs via cPanel, follow these steps:

  1. Begin by logging on to cPanel.
  2. Click the icon Raw Access under Metrics.
  3. If you scroll down a bit on the page, you’ll find a table containing the available logs. If you click the doman name in the Domain column, you will get to download a gz-compressed file containing the log.

In the table you’ll see the following:

  • Domain: Shows which domain the log file is for. Keep in mind that traffic towards http is logged separately from https. The latter is labelled with (SSL) next to the domain name.
  • Last Update: Timestamp of when the log file was last updated.
  • Disk Usage: How much disk space each log file uses. A large file means that there has been a lot of traffic going towards the domain.
  • Linked Domains: Here you see what addon domain that represents the domain visible in the Domain column.

If you scroll further down on the page, you will see the header Archived Raw Logs. If archiving is activated (see below), you will reach these older logs here.

Via SSH

Please note that this method is intended for advanced users.

To access your logs via SSH, begin by connecting to the web hosting account via SSH. Once connected, to to the folder access-logs available in the home directory of your account:

cd ~/access-logs

Here you will find the latest access logs for your account (the logs are rotated once per day, so the oldest data you may see is for the last 24 hours).

If you have activated archiving of logs (see below), you will find the log archive in the folder logs, available in the home directory of your account:

cd ~/logs

Activate archiving of logs

Access logs are being rotated once per day, so if you want access to older logs than for the last 24 hours, you need to activate archiving of logs. To do this, follow these steps:

  1. Begin by logging on to cPanel.
  2. Click the icon Raw Access under Metrics.
  3. Under Configure Logs, check the checkbox next to Archive log files to your home directory after the system processes statistics. The system currently processes logs every 24 hours..

If you want to save disk space on your web hosting account, also check the checkbox next to Remove the previous month's archived logs from your home directory at the end of each month.. You will then have access to the past month’s logs, but none older than that. Don’t check the checkbox if you want to save all logs.

  1. Don’t forget to click Save after adjusting the settings.
Was this article helpful?

Related Articles