
108
Chapter 12
Working with Log Files
Choosing binary or ASCII
You can configure the Traffic Server to create event log files in either of the following:
•
ASCII - these files are human readable and can be processed using standard, off-the-shelf log analysis
tools. However, Traffic Server must perform additional processing to create the files in ASCII, resulting
is a slight increase in overhead. Also, ASCII files tend to be larger than the equivalent binary files. ASCII
log files have a
.log
file name extension by default.
•
Binary - files in binary have the advantage of generating lower system overhead, as well as generally
occupying less space on the disk depending on the type of information being logged. You must, however,
use a converter application before you can read or analyze these files using standard tools. Binary log files
use a
.blog
file name extension by default.
While binary log files typically require less disk space, this is not always the case. For example, the value 0
(zero) requires only one byte to store in ASCII, but requires four bytes when stored as a binary integer. On the
other hand, if you define a custom format that logs IP addresses, a binary log file would only require four bytes
of storage per 32-bit address. However, the same IP address stored in dot notation would require around 15
characters (bytes) in an ASCII log file.
For standard log formats, you select Binary or ASCII in the Standard Event Log Formats section of the
Logging page, refer to
Setting standard log file format options‚ on page 101
. For custom log formats, refer to
Using traditional custom formats‚ on page 104
.
Before selecting ASCII versus binary for your log files, consider the type of data that will be logged. Try
logging for one day using ASCII and then one day using binary. Assuming that the number of requests is
roughly the same for both days, you can calculate a rough metric comparing the two formats.
Using logcat to convert binary logs to ASCII
You must convert a binary log file to ASCII before you can analyze it using standard tools.
To convert a binary log file to ASCII:
1. Telnet into the HP web cache appliance and select Shell Access as described in
Overview of Access
Methods‚ on page 7
.
2. Change to the directory containing the binary log file,
home/TS4/<version>/logs
.
3. Make sure that the
logcat
utility is in your path.
4. Enter the following command:
logcat [options] [input_filename...]
NOTE
For XML-based custom log files, in addition to the ASCII and binary options, you can
also write a 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. In addition, writing to a pipe does not stop when logging space is exhausted
because the pipe does not use disk space. Refer to
logs_xml.config‚ on page 171
for
more information about the ASCII_PIPE option.