
105
Chapter 12
Working with Log Files
Example
The following example custom log definition produces a log file that records the client host IP address, the
client request universal resource identifier, and the proxy response status code:
format:enabled:1:minimal:%<chi> / %<cqu> / %<pssc>:minimalist:ASCII:myheader
For more information about configuring the
logs.config
file, see
logs.config‚ on page 169
.
10. Save and close the
logs.config
file.
11. Run the command
traffic_line -x
to apply the configuration changes.
Using XML-based custom formats
Traffic Server supports a broad range of logging formats, including both standard and traditional custom
formats. However, associating these formats to specific servers, collation hosts, and log files is rather coarse-
grained. For example, when you enable collation, it is generally enabled for all formats and only to a single
collation server.
Traffic Server’s XML-based custom log specification is more flexible, enabling you to institute much more
control over the type of information recorded in your log files.
The heart of the XML-based custom logging feature is an XML-based logging configuration file
(
logs_xml.config
) that enables you to create very modular descriptions of logging objects. The
logs_xml.config
file uses three types of objects to create custom log files:
•
The
LogFormat
object defines the content of the log file using printf-style format strings.
•
The
LogFilter
object defines a filter so that you include or exclude certain information from the log file.
•
The
LogObject
object specifies all the information needed to produce a log file. For example:
o
The name of the log file (required).
o
The format to be used (required). This can be a standard format (Squid or Netscape) or a previously
defined custom format (a previously defined
LogFormat
object).
o
The file mode (ASCII, Binary, or ASCII_PIPE). The default is ASCII.
The ASCII_PIPE mode writes an XML-based custom log file to a pipe so that the logging data is sent
to a buffer in memory. Other processes can then read the data using standard I/O functions. The
advantage of using this option is that Traffic Server does not have to write to disk, freeing disk space
for other tasks.
o
Any filters you want to use (previously defined
LogFilter
objects).
o
The collation servers that are to receive the log files.
o
The protocols you want to log (if the protocols tag is used, Traffic Server will only log transactions
from the protocols listed, otherwise, all transactions for all protocols are logged).
file_name
Enter a name you want to use for the log file created with this format.
type
Enter one of the following:
•
ASCII
•
BINARY
header
If you want your custom log file to have header text, enter it here.
Field
Description