algorand / go-algorand

Algorand's official implementation in Go.
https://developer.algorand.org/
Other
1.35k stars 470 forks source link

Allow multiple log archive files #6055

Open whiteMetalApe opened 3 months ago

whiteMetalApe commented 3 months ago

Problem

Currently, there is only one log archive file like node.archive.log, multiple log archives are not possible. For example, if someone wants to have a daily/weekly/monthly log archive file, that would not be possible.

Solution

Option 1. Implement a configurable log rotation functionality to enable multiple log archive files. Option 2. Establish compatibility with unix logrotate (log file has to be flushed upon SIGHUP signal, etc)

Dependencies

Urgency

onetechnical commented 2 days ago

While it is true that there is not a timed rotation, you can rotate to multiple named files. For example:

    "LogArchiveMaxAge": "168h",
    "LogArchiveName": "node.log.{{.Year}}{{.Month}}{{.Day}}_{{.Hour}}{{.Minute}}{{.Second}}-{{.EndYear}}{{.EndMonth}}{{.EndDay}}_{{.EndHour}}{{.EndMinute}}{{.EndSecond}}.gz",
    "LogSizeLimit": 1073741824,

This will rotate when the log reaches 1 GB, date stamp them when they were rotated, and keep the past seven days.

Reference: https://developer.algorand.org/docs/run-a-node/reference/config/