From 3da3afa5764bcec2d50b219446579b5770051f32 Mon Sep 17 00:00:00 2001 From: Niall Crowe Date: Fri, 25 Feb 2022 09:25:30 +0000 Subject: 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 Signed-off-by: Valentin Rothberg --- libpod/events/config.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libpod/events/config.go') 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 ... -- cgit v1.2.3-54-g00ecf