What are log files?

A Web server log file is a file that records all events that are happening on your Web server. All error, alerts and activities are recorded on the log files. In the event of an error the log file is the first place you check. There are 2 types of log files on Apache:

  1. Access log: It shows details about the incoming connection requests to the web server. It includes the user visits, pages that are visited, success of request, the processing time of these requests etc.
  2. Error log: It shows the details on the errors encountered by the webserver while processing requests.

Location of Web server log

The location of log files depends on the version of Apache and Linux that’s on the server. The log files are normally located at a default location. Apache can be configured to store these log files at a custom location.

 
By default, you should be able to find the access and error logs in one of these directories:

  • /var/log/apache/
  • /var/log/apache2/
  • /etc/httpd/logs/

How to Access Web server logs?

On cPanel:

1. Login to cPanel account

2. Under ‘METRICS’ select ‘Errors’ to access the error logs

Web server Log

3. This log will list the last 300 error messages on your website. Details including date and time of error, the file generating the error and many more details can be got from this error log. From these details you can identify the exact error to fix.

4. Under ‘METRICS’ select ‘Raw Access’ to access the access logs

Web server Log

5. This log will list the access details on your website. Details including the traffic on your website, details on the requests made to the server etc

On Command Prompt

1. By default, the log will be located at:

Apache: /var/log/apache2/error.log

Nginx: /var/log/nginx/error.log

2. Enter the below command on the terminal to view the latest 100 entries in the logs:

sudo tail -100 /var/log/apache2/error.log

3. To search a specific term in the log file. Execute the below command:

sudo grep search_string /var/log/apache2/error.log

Replace ‘search_string’ with your search string. Here we are filtering for the ‘search_string’ keyword in the log entries.

Conclusion

A log file is the first place you check for any error that is received. It is a very important file that stores important information that gives you clues to debug any error.

If you want all your KPI‘s or Business metrics monitored on a single dashboard, join our BETA.

By Liz Mathew

Founder, InsightDials

error: Content is protected !!