
109
Chapter 12
Working with Log Files
The following table describes the command-line options:
If no input files are specified,
logcat
reads from the standard input (
stdin
). If you do not specify an output
file,
logcat
writes to the standard output (
stdout
).
For example, to convert a binary log file to an ASCII file, you can use the
logcat
command with either of
the following options:
logcat binary_file > ascii_file
logcat -o ascii_file binary_file
The binary log file is not modified by this command.
Rolling event log files
Traffic Server provides automatic log file rolling. This means that at specific intervals during the day, Traffic
Server closes its current set of log files and opens new log files.
Log file rolling offers the following benefits:
•
It defines an interval over which log analysis can be performed
•
It keeps any single log file from becoming too large and assists in keeping the logging system within the
specified space limits
•
It provides an easy way to identify files that are no longer being used so that an automated script can clean
the logging directory and run log analysis programs
You should roll log files several times a day. Rolling every 6 hours is a good guideline to follow.
Rolled log file name format
Traffic Server provides a consistent name format for rolled log files that allows you to easily identify log files.
When Traffic Server rolls a log file, it saves and closes the old file and starts a new file. The old file is renamed
to include:
•
The hostname of the Traffic Server that generated the log file
•
Two time stamps separated by a hyphen (
-
) that represent the earliest and latest time stamps for the entries
contained in the rolled log file
Option
Description
-o output_file
Specifies where the command output is directed.
-a
Automatically generates the output file name based on the input file name. If the input
is from stdin, this option is ignored.
For example:
logcat -a squid-1.blog squid-2.blog squid-3.blog
generates
squid-1.log, squid-2.log, squid-3.log
-S
Attempts to transform the input to Squid format, if possible.
-C
Attempts to transform the input to Netscape Common format, if possible.
-E
Attempts to transform the input to Netscape Extended format, if possible.
-2
Attempt to transform the input to Netscape Extended-2 format, if possible.
NOTE
Use only one of the following options at any given time: -S, -C, -E, or -2.