diff options
author | Niall Crowe <nicrowe@redhat.com> | 2022-02-25 09:25:30 +0000 |
---|---|---|
committer | Niall Crowe <nicrowe@redhat.com> | 2022-04-14 09:35:29 +0100 |
commit | 3da3afa5764bcec2d50b219446579b5770051f32 (patch) | |
tree | 66b2319d84d1eac23169b131ddbb96a6e9c3c4b6 /libpod/events/config.go | |
parent | 15712c76fb198cec7509ff0cf401e357401d2d7d (diff) | |
download | podman-3da3afa5764bcec2d50b219446579b5770051f32.tar.gz podman-3da3afa5764bcec2d50b219446579b5770051f32.tar.bz2 podman-3da3afa5764bcec2d50b219446579b5770051f32.zip |
Add log rotation based on log size
Add new functions to logfile.go for rotating and truncating
the events log file once the log file and its contents
exceed the maximum size limit while keeping 50% of the
log file's content
Also add tests to verify log rotation and truncation
Signed-off-by: Niall Crowe <nicrowe@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'libpod/events/config.go')
-rw-r--r-- | libpod/events/config.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libpod/events/config.go b/libpod/events/config.go index 188d15578..35680a275 100644 --- a/libpod/events/config.go +++ b/libpod/events/config.go @@ -60,6 +60,8 @@ type EventerOptions struct { // LogFilePath is the path to where the log file should reside if using // the file logger LogFilePath string + // LogFileMaxSize is the default limit used for rotating the log file + LogFileMaxSize uint64 } // Eventer is the interface for journald or file event logging @@ -171,6 +173,8 @@ const ( Restart Status = "restart" // Restore ... Restore Status = "restore" + // Rotate indicates that the log file was rotated + Rotate Status = "log-rotation" // Save ... Save Status = "save" // Start ... |