
107
Chapter 12
Working with Log Files
•
COUNT
•
SUM
•
AVERAGE
•
FIRST
•
LAST
You can apply each of these operators to specific fields, requesting it to operate over a specified interval.
Summary logs represent a trade-off between convenience and information granularity. Since you must specify
a time interval during which only a single record is generated, you will necessarily be losing a certain amount
of information. If you want the convenience of summary logs, but also need the detail of a conventional log
file, consider creating and enabling two custom log formats—one using aggregate operators and the other not.
To create a summary log file:
1. Telnet into the HP web cache appliance and select Shell Access as described in
Overview of Access
Methods‚ on page 7
.
2. Open the
logs_xml.config
file located in the Traffic Server’s
config
directory
with Vi.
3. Define the format of the log file as follows:
<LogFormat>
<Name = "summary"/>
<Format = "%<operator(field)> : %<operator(field)>"/>
<Interval = "n"/>
</Format>
where:
operator
is one of the five aggregate operators (COUNT, SUM, AVERAGE, FIRST, LAST). You can
specify more than one operator in the format line.
field
is the logging field that you want to aggregate.
n
is the interval in seconds between summary log entries.
For more information, see
logs_xml.config‚ on page 171
.
For example, the following format generates one entry every 10 seconds, with each entry summarizing the
timestamp of the last entry of the interval, a count of the number of entries seen within that 10-second
interval, and the sum of all bytes sent to the client.
<LogFormat>
<Name = "summary"/>
<Format = "%<LAST(cqts)> : %<COUNT(*)> : %<SUM(psql)>"/>
<Interval = "10"/>
</Format>
4. Define a
LogObject
that uses this format.
5. Save and close the configuration file.
6. Run the command
traffic_line -x
to apply the configuration changes.
IMPORTANT
You cannot create a format specification that contains both aggregate operators and
regular fields. For example, the following specification would be invalid:
<Format = "%<LAST(cqts)> : %<COUNT(*)> : %<SUM(psql)> :
%<cqu>"/>