Introduction
The Common Log Format is the line format of web server access logs. It came from the NCSA web server and was kept by the Apache HTTP Server, and it is still what Apache and nginx write by default, usually in its extended form, the Combined Log Format. Each line records one request: who made it, when, what was asked for and how the server answered.
The files are usually called access.log or access_log, under
/var/log/apache2, /var/log/httpd or
/var/log/nginx. Many analysis tools read them directly.
Structure
A Common Log Format line has seven fields separated by spaces: the client’s address, the identity from identd, the signed-in user name, the time in square brackets, the request line in double quotes, the status code and the size of the response in bytes. A field with no value is written as a hyphen.
The Combined Log Format adds two more quoted fields at the end: the referring page and the browser’s User-Agent string. Servers can be set to log other fields, so a particular file may carry more.
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
Not described
Known, not yet covered
- Reference: the other web servers’ log variables (IIS, lighttpd, Caddy,
HAProxy) and the Apache modules that add directives, such as
mod_ssl(fields). - Viewer: a
.logof Common Log Format lines opens in the plain text viewer, whose Log tab gives each line’s time, a level taken from the status (5xx error, 4xx warning), the client address and the request, with a row for every line. The identd and user fields, the byte count and, in the combined form, the referrer and user agent are joined into the message text and not shown as columns of their own, and nothing is filtered by status or path. A file whose extension is not.logopens as plain text without the Log tab.
Unknown
- Reference: the original NCSA httpd specification of the format and the RFC 1413 identd details were not read; the history on the pages is not backed by a source.
Also used for
- Plain text log – One event per line of text, usually led by a time, as syslog writes it.
- W3C Extended Log File Format – IIS web logs: a #Fields directive names the fields on every line.
Links
Software
- Apache HTTP Server – web server that writes these logs (Linux, Windows, Unix)
- nginx – web server that writes the combined format by default (Linux, Windows, Unix)
- GoAccess – log analyser for the terminal and the browser (Linux, macOS)
- AWStats – web log analyser that builds statistics pages (Linux, Windows)
Reference
- mod_log_config – the Apache documentation of the log formats and their fields