Apache - How to find web server log files: access log, error log

  • Last update: Apr 3, 2024
  • Views: 38
  • Author: Admin
Apache - How to find web server log files: access log, error log

Hello colleagues.

In the Apache web server, all events are recorded in special logs. Event logs are plain text files that store information about all requests processed by the Apache server. Apache also logs requests that come in from clients, responses sent by Apache to a client request, and Apache-related internal activities.

In this article, we will talk about the basics of Apache logging, what types of logs are generated by Apache and where they are stored and how to move them.

 

The content of the article:

  1. Apache log types.
  2. access_log.
  3. error_log.
  4. View log.
  5. Location of magazines.

 

1. Types of Apache logs.

The Apache web server uses two kinds of logs, the first is the access log and the second is the error log.

Name of magazines:

  • access_log - access log.
  • error_log - error log.

 

2. Access_log log.

The access_log contains information about all requests processed by the Apache server. This log contains information such as request time, response code, response time, and IP address.

An example of a typical log entry:

10.10.10.112 - - [12/Dec/2022:12:00:50 +0200] "GET /style/site/styles.css HTTP/1.1" 200 210


 

3. error_log log.

The error_log contains information about errors encountered by the Apache web server while processing requests, such as a missing page. This log also includes diagnostic information about the Apache server itself.

An example of a typical log entry:

[Tue Dec 13 08:46:38.640608 2022] [http2:warn] [pid 913:tid 140543821785408] AH02951: mod_ssl does not seem to be enabled


 

4. View the log.

The logs in Apache are plain text files and can be easily opened by any tool that can read the files. On Linux-based operating systems, this can be cat or tail commands.

Tail command example :

$. sudo tail -100 /etc/httpd/logs/error_log

The tail command with the  -100 option  will display the previous 100 entries in the error log.


 

5. Location of magazines.

Where Apache logs are stored depends on the operating system you are using.

  • Red Hat, CentOS - /var/log/httpd
  • Debian and Ubuntu -  /var/log/apache2
  • FreeBSD - /var/log

 

Thank you all, I hope my article was of some help to you.

SIMILAR ARTICLES