Module Async_unix.Log.Rotation

type t

description of boundaries for file rotation.

If all fields are None the file will never be rotated. Any field set to Some will cause rotation to happen when that boundary is crossed. Multiple boundaries may be set. Log rotation always causes incrementing rotation conditions (e.g. size) to reset.

The condition keep is special and does not follow the rules above. When a log is rotated keep is examined and logs that do not fall under its instructions are deleted. This deletion takes place on rotation only, and so may not happen. The meaning of keep options are:

Log rotation does not support symlinks, and you're encouraged to avoid them in production applications. Issues with symlinks:

include sig ... end
val sexp_of_t : t ‑> Sexplib.Sexp.t
module type Id_intf : sig ... end
val create : ?⁠messages:int ‑> ?⁠size:Core.Byte_units.t ‑> ?⁠time:Core.Time.Ofday.t ‑> ?⁠zone:Core.Time.Zone.t ‑> keep:[ `All | `Newer_than of Core.Time.Span.t | `At_least of int ] ‑> naming_scheme:[ `Numbered | `Timestamped | `Dated | `User_defined of (module Id_intf) ] ‑> unit ‑> t
val default : ?⁠zone:Core.Time.Zone.t ‑> unit ‑> t

Sane log rotation defaults.

Writes dated log files. Files are rotated every time the day changes in the given zone (uses the machine's zone by default). If the dated log file already exists, it's appended to.

Logs are never deleted. Best practice is to have an external mechanism archive old logs for long term storage.