3.2.1 Website logs and logging settings
Access logs and error logs are an important tool for websites that help administrators and developers monitor and analyze various events that occur on the server.
Access logs (access.log) store information about every request a user makes to a website server. These include data such as URLs, HTTP methods (e.g. GET, POST), response statuses (e.g. 200 for successful requests or 404 for page not found), and other details that help understand how users interact with a website.
Error logs (error.log) record any errors that occur while processing requests on the server. These can be errors in the software code of the website, unavailable resources or any other problems that affect the functioning of the site.
Log of requests to the site
The access log (access.log) is a file that stores information about all HTTP requests coming to your website.
Inform: the access.log availability report may contain the following information
- Client IP address: is the address from which the request to the server was made.
- Date and time of request: indicates the time and date when the request was made.
- HTTP Request Method: is the method used to request a resource, such as GET or POST.
- Server Response Status: is an HTTP status code that indicates whether the request was successfully processed. For example, 200 means a successful response, and 404 means a resource not found.
- Browser Information: additional information about the web browser the customer is using, such as browser name and version.
Site error logs
The error log (error.log) is very useful when debugging the site, configuring new modules/themes and installing scripts. For example, if you see a white page or errors 40*/50* or others, then first of all you need to view the error log entries for this site, for example your.domain.com.error.log, in which php-handler errors will be displayed. The error log is the most optimal way to monitor and detect errors during the operation and configuration of the site.
In addition, it can be noted that the error log can contain information not only about errors of the php processor, but also about other errors that occur during the operation of the website. It also helps to identify problems with the server configuration and other technical deficiencies that may affect the correct operation of the web resource.
Setting up log rotation
By default, both types of logs are enabled for domains and are rotated daily. When rotating, the logs are reset and the archives are moved to the logs directory (~/logs)
, which can be viewed in the File Manager section.
It is possible to change the standard values when creating a WWW domain or editing its settings, in the World Wide Web - WWW domains section, then open the properties of the site you want and go to the Logs tab
During the settings, it is possible to:
- Disable/enable logging;
- Change the rotation period (daily, weekly, monthly);
- Specify the maximum number of archives that will be stored on the server (the default value is 10);
- Enable/disable AWStats (report generator) and configure it.
AWStats:
AWStats (short for Advanced Web Statistics) is a web analytics tool that reports traffic to your site. It analyzes information from server log files and displays the received data in the form of tables and graphs.
To view statistics, you need to use the link https://Ваш_домен.com/webstat/
, for authorization use your login and password from the hosting control panel.
Important: Disabling logging on your sites is not recommended, as it can make it harder to identify problems in the future.