Den här artikeln finns även på:
Svenska
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:
- Begin by logging on to cPanel.
- Click the icon
Raw Access
underMetrics
. - 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
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:
- Begin by logging on to cPanel.
- Click the icon
Raw Access
underMetrics
. - Under
Configure Logs
, check the checkbox next toArchive log files to your home directory after the system processes statistics. The system currently processes logs every 24 hours.
.
- Don’t forget to click
Save
after adjusting the settings.