Documentation
¶
Overview ¶
Package logging builds the agent's structured logger over a size- and age-bounded file on the state mount, teed to stderr.
Two guarantees this package exists to keep, both PRD requirements:
- Log lines written before a crash are readable after a restart. That is why the sink is a file on the bind-mounted state directory and not only stderr.
- The agent must never be the reason a small VPS runs out of disk. That is why the on-disk total is bounded by whichever of size or age is hit first.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rotator ¶
type Rotator struct {
// contains filtered or unexported fields
}
Rotator forces a log rotation on a fixed interval.
This is NOT redundant with lumberjack's own behaviour, and deleting it would silently break age-based retention. lumberjack rotates on SIZE only, and it applies MaxAge only at the moment a rotation happens. A quiet agent never fills a file, so it never rotates, so it never prunes — its agent.log would keep entries from months ago while sitting comfortably under the size cap. The ticker is what makes DEVMON_LOG_MAX_AGE_DAYS mean anything.
func NewRotator ¶
NewRotator returns a Rotator that rotates lj every interval.
type Sink ¶
Sink owns the agent's logger and the file it writes to. It must be closed on shutdown so buffered bytes reach disk before the process exits.