Netra Proxy Cache Server User's Manual

Managing Proxy Cache Service Log Files

The Netra Proxy Cache product is shipped with a command-line program, rotlog, that enables you to rotate and back up proxy cache service log files. These files correspond to the following types referred to in the Proxy Cache Log Administration page:

For each type specified in the preceding list, the rotlog command can perform the following functions:

By default on a Netra Proxy Cache Server, rotlog is run by cron, using the following entry:


25 4,12,20 * * * /opt/SUNWcache/sbin/rotlog -M all -S 100

The effect of this cron job is that rotlog rotates all types of logs (the default) at 4:25 AM, 12:25 PM, and 8:25 PM, daily, enforcing a minimum available amount of space of 100 MB (-S 100) for all types of logs (-M all). If the rotlog command encounters less space than specified in an -S option, it deletes log files, starting with the oldest, until the specified amount of space is reached. Using the -M option, you can establish minimum space thresholds for one or more log types (including all log types).

The -M option (specifying log types for which to set minimum space thresholds) is always used in conjunction with the -S option (which sets the minimum space threshold).

You might specify a cron job to use rotlog to copy logs to a remote file server. For example:


15 2 * * * /opt/SUNWcache/sbin/rotlog -F cache -d /pub/logs -h hepa -u anonymous

At 2:15 AM, daily, the preceding command copies logs of type cache (-F cache) to the directory /pub/logs (-d /pub/logs) on the server hepa (-h hepa), using the user id, for ftp purposes, of anonymous (-u anonymous). Following the successful copy operation, rotlog deletes the local log files that were copied.

On a remote host, rotlog renames a copied file to the following form:


<type>.log.YYYYMMDD

where <type> is one of access, cache, store, or hierarchy, YYYY is the current year, MM the current month, and DD the current day.

If there are multiple local files of the same type (for example, access.log.0 and access.log.1), rotlog appends an integer extension to the remote file name, starting with .1 for the oldest file and incrementing with each successive file of the same type. Continuing with our example, access.log.0 and access.log.1 are renamed as follows:

Table 15-1 Local and Remote Log File Names

Local Name 

Remote Name 

access.log.0

access.log.19980202.2

access.log.1

access.log.19980202.1

Note that access.log.1, the local file, is the older of the two files.

In a rotlog command, you can use the -x option to change the format of the file extension of a copied, using the format specifications listed in the strftime (3C) man page. Use of -x can prevent the overwriting of copied files when you copy log files more than once a day. For example, you can modify the preceding cron job as follows:


15 2,12 * * * /opt/SUNWcache/sbin/rotlog -F cache -d /pub/logs \
-h hepa -u anonymous -x %Y%m%d%H%M

This example is the same as the preceding, except:

The addition of hours and minutes to the default file extension prevents the overwriting of copied files.

See the rotlog (1M) man page for a description of all of the rotlog options.