Documentation
¶
Overview ¶
Package file is a simple log-to-disk plugin with size-based rotation. Useful for operators who want a persistent record of logs separate from Docker's own log files (which rotate on container restart and aren't easy to grep).
Design: small, sync, lossy on crash. We don't reach for an external rotator like lumberjack to keep the dep tree light; rotation is a bounded slot system: when the active file exceeds MaxBytes, it's renamed to <path>.1 and a new active file opens. MaxFiles controls how many .1, .2, … to keep before deleting.
This plugin writes JSON lines (one record per line), the same format as the stdout handler. So you can `cat /logs/pulse.log | jq` and it Just Works.
Operator config:
BEACON_LOG_FILE_PATH — file path (e.g. /config/logs/pulse.log) BEACON_LOG_FILE_MAX_BYTES — rotate at this size (default 10MB) BEACON_LOG_FILE_MAX_FILES — keep this many rotated files (default 5)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements log.Plugin.
func New ¶
New opens the file (creating parent dirs if needed) and returns a started plugin. Returns an error if the path is empty or the parent dir can't be created.