# logfileng - write a logfile with rotation

Writes a log file of the status of monitors. Rotates and deletes old log files based on size or age.

The logfile format is:

    datetime monitor-name: status; VFC=vfc (message) (execution-time)

where the fields have the following meanings:

datetime

  the datetime of the entry. Format is controlled by the `dateformat` configuration option.

monitor-name

  the name of the monitor

status

  either `ok` if the monitor succeeded, or `failed since YYYY-MM-DD HH:MM:SS`

vfc

  the virtual failure count: the number of failures of the monitor beyond its tolerance. Not present for ok lines.

message

  the message the monitor recorded as the reason for failure. Not present for ok lines.

execution-time

  the time the monitor took to execute its check

filename
  Type:

    string

  Required:

    true

  the filename to write to. Rotated logs have either `.N` (where N is an incrementing number) or the date/time appended to the filename, depending on the rotation mode.

rotation_type
  Type:

    string

  Required:

    true

  one of `time` or `size`

when
  Type:

    string

  Required:

    false

  Default:

    `h`

  Only for rotation based on time. The units represented by `interval`. One of `s` for seconds, `m` for minutes, `h` for hours, or `d` for days

interval
  Type:

    integer

  Required:

    false

  Default:

    `1`

  Only for rotation based on time. The number of `when` between file rotations.

max_bytes
  Type:

    bytes

  Required:

    yes, when rotation_type is `size`

  the maximum log file size before it is rotated.

backup_count
  Type:

    integer

  Required:

    false

  Default:

    `1`

  the number of old files to keep

only_failures
  Type:

    boolean

  Required:

    false

  Default:

    false

  set to have only monitor failures written to the log file (almost, but not quite, turning it into an alerter)