Log Cleaner Stage

The Log Cleaner Stage will allow you to keep a directory of logs on your robot trimmed to only consume a fixed amount of space.

For example, if you don’t intend to offload logs very often, and want to store no more then 20GB of logs, you can use this tool to periodically delete old logs and keep only the newest.

Configuration

A LogCleanerStageConfiguration structure is passed to the log cleaner:

  • storage_base_path - The path to the area on disk to keep clean
  • maximum_log_usage_mb - The amount of space (in megabytes) that can be used by logs
  • check_interval_ms - The interval to check for free space
  • minimum_file_age_s - Refuse to delete files younger then this age

The log cleaner will not delete any logs that are being actively written to, no matter how old they are.

Interacting

The stage works on its own. It needs no input to function.

Metrics

The stage emits statistics periodically on the statistics channel. This indicates how many logs it has removed or any other errors it has encountered.

  • cycles_executed_successfully - The number of cycles we have run
  • cycles_failed - The number of cycles we experienced an exception/error on (should be zero)
  • files_removed - The number of files that have been removed
  • visible_log_count - The number of visible logs
  • log_disk_space_consumed_b - The amount of disk space consumed by data logs right now