apache tutorial - Apache Log Format - apache - apache web server - apache server - apache2
- Apache logs provide detailed information that help to detect common issues with server.
- In order create access logs, mod_log_configmodule must be enabled.
Three directives available in apache config file i.e.
- TransferLog: Creating a log file.
- LogFormat : Specifying a custom format.
- CustomLog : Creating and formatting a log file.
- TransferLog directive is available in the apache configuration file and it rotates virtual host log files as per set parameters.
Two types of Apache Log Format
- Common Log Format
- Combined Log Format.
- You can enable them by editing the apache configuration file i.e. apache2.conf (Debian/ubuntu) or httpd.conf (rpm based systems) file
Common Log Format
Common Log generated by Apache
Combined Log Format
- %h is the remote host
- %l is the identity of the user determined by identd
- %u is the user name determined by HTTP authentication
- %t is the time the server finished processing the request.
- %r is the request line from the client. ("GET / HTTP/1.0")
- %>s is the status code sent from the server to the client (500, 404 etc.)
- %b is the size of the response to the client (in bytes)
- Referer is the page that linked to this URL.
- User-agent is the browser identification string.
Combined Log generated by Apache:
- Custom Log creates separate log file for each Virtual Host on your server. It needs to be specified in the virtual host section of the config file.
- You can see below mentioned virtual host configuration, generated log will be custom for that virtual host and the format will be combined.
Learn Apache - Apache tutorial - apache log format - Apache examples - Apache programs