In this article, you will learn about viewing the Access and Error logs of your Application by remotely connecting to the server via SSH or SFTP. Here, access logs refer to the logs of Apache (for dynamic requests such as PHP requests), NGINX (for static assets such as images/JS/CSS), and PHP (detailed PHP process information such as files/routes, CPU, and memory consumption). On the other hand, error logs refer to the Apache Error Logs that contain information about the issues that an application encounters, and this may contain details of errors and warnings that indicate potential problems with an event or application configuration.

Analyzing logs can be beneficial when it comes to debugging, troubleshooting the application-level issues, and maintaining a good website’s health because logs provide information about web requests, the status of requests, visitor’s IP addresses, viewed pages, user-agent(s), PHP processes, CPU, and memory consumption.

How to View Access & Error Logs

Application logs can also be monitored using the Cloudways Platform but please note that the logs section of the Cloudways Platform will only display the recent 1000 log entries of Apache, NGINX, and PHP individually but if you are looking to view the previous logs as well, then you need to connect to your server via SSH/SFTP and here is how you can do it.

Important

If you use Cloudflare or Sucuri, then you need to select Cloudflare or Sucuri under WAF Module in the server settings because it will allow you to view the real IP addresses of the visitors visiting your site. Cloudflare and Sucuri are very well-known reverse-proxy services. When opting for their services, you update your default nameservers with their nameservers, point DNS records to them, and then traffic is routed to your website hosted on the Cloudways’ server.

Application logs are maintained in the logs folder of your application directory. First of all, choose which method you want to use from SSH or SFTP to connect to your server.

Using SSH

Let's begin with connecting the server via SSH so you can access the logs folder of your application so simply follow the steps given below.

Step #1

You can connect to your server via SSH in two ways, so choose your preferred option from the below options. You can also click on the hyperlink text of bullet points to learn about the procedure of connecting remotely to the server.

Tip

If you would like to know what is SSH and why it is used, then Click Here to find out.

In this example, we are using Master Credentials to access the server remotely.

Step #2

Now, you need to navigate to the logs folder of your application so execute the following command:

cd applications/<your_application_name>/logs

Important

Angle brackets are included to highlight the position of your input, so make sure to remove the angle brackets. Click Here to find out where your application name is located.

Step #3

You will find all the access and error log files of Apache, NGINX, and PHP listed in the logs folder. Therefore, type the listing command to list the application log files.

ls -l

You can view the logs easily using the following command.

tail -f <log-file-name>

Using SFTP

Let's begin with connecting the server via SFTP so you can access the logs folder of your application so simply follow the steps given below.

Step #1

You can connect to your server via SFTP using any SFTP client, so Click Here if you want to learn how.

Tip:

If you would like to know what is SFTP and why it is used, then Click Here to find out.

In this example, we are using Master Credentials to access the server remotely.

We have used the FileZilla client. You will see a similar window after a successful connection, as shown below. Please be advised the pane at the left shows your server data.

Now, you need to go to the logs folder of your application so navigate to this path /applications/<your-application-name>/logs.

Important

Angle brackets are included to highlight the position of your input, so make sure to remove the angle brackets. Click Here to find out where your application name is located.

Step #2

You will find all the access and error log files of Apache, NGINX, and PHP listed in the logs folder of your application. Therefore, you may download the logs to view them.

That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.

Did this answer your question?