TAG NAME logformat

Description Defines the format for storing access logs in access.log file
Build Option
Default
Usage
logformat  <name> <format specification>
Default
none


Synopsis
Using this, the default log format can be changed according to the requirement. This customizable format will be needed when you want to perform analysis on the logs stored in access.log file.

Arguments

name
Identifier holding the customized logformat
format specification
It is a string embedded with % format codes


% format codes all follow the same basic structure where all but the formatcode is optional. Output strings are automatically quoted as required according to their context and the output format modifiers are usually unneeded but can be specified if an explicit quoting format is desired. The logformat name should be added at the end of access log file in the access_log tag.


% ["|[|'|#] [-] [[0]width] [{argument}] formatcode

quoted string output format
[ Squid log quoted format as used by log_mime_hdrs
# URL quoted output format
' No automatic quoting
- left aligned
width
field width. If starting with 0 then output is zero padded
{arg}
argument such as header name etc

Format codes:

>a
Client source IP address
>A Client FQDN
<A Server IP address or peer name
la Local IP address (http_port)
lp Local port number (http_port)
ts Seconds since epoch
tu subsecond time (milliseconds)
tl Local time. Optional strftime format argument default %d/%b/%Y:%H:%M:S %z
tg GMT time. Optional strftime format argument default %d/%b/%Y:%H:%M:S %z
tr Response time (milliseconds)
>h Request header. Optional header name argument on the format header[:[separator]element]
<h Reply header. Optional header name argument as for >h
un User name
ul
User login
ui User ident
ue User from external acl
Hs HTTP status code
Ss Squid request status (TCP_MISS etc)
Sh
Squid hierarchy status (DEFAULT_PARENT etc)
mt MIME content type
rm Request method (GET/POST etc)
ru
Request URL
rv
Request protocol version
et Tag returned by external acl
ea
Log string returned by external acl
<st Reply size including HTTP headers
<sH Reply high offset sent
<sS Upstream object size
% a literal % character

Example(s)
logformat Squid  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt