Skip to main content

Logging to a Compressed File

AMPS supports logging to compressed files as well. This is useful when trying to maintain a smaller logging footprint. Compressed file logging targets are the same as regular file targets except for the following:

  • The Protocol value is gzip instead of file.
  • The log file is written with gzip compression.
  • The RotationThreshold is metered off of the uncompressed log messages.
  • Makes a trade off between a small increase in CPU utilization for a potentially large savings in logging footprint.

Example

The following logging target definition would place a log file with a name constructed from the timestamp and current log rotation number in the ./logs subdirectory. The first log would have a name similar to ./logs/20121223125959-0.log.gz and would store up to 2GB of uncompressed log messages before creating the next log file named ./logs/201212240232-1.log.gz.

<AMPSConfig>
...
<Logging>
<Target>
<Protocol>gzip</Protocol>
<Level>info</Level>
<FileName>./logs/%Y%m%d%H%M%S-%n.log.gz</FileName>
<RotationThreshold>2G</RotationThreshold>
</Target>
</Logging>
...
</AMPSConfig>