hotfix(agent): only retain 1 logfile at a time (#7815)

This commit is contained in:
Colin Adler
2023-06-02 12:28:38 -05:00
committed by GitHub
parent 8f736fe5f5
commit 6fdebd8a07
+4
View File
@@ -68,6 +68,8 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
logWriter := &lumberjack.Logger{
Filename: filepath.Join(logDir, "coder-agent-init.log"),
MaxSize: 5, // MB
// Without this, rotated logs will never be deleted.
MaxBackups: 1,
}
defer logWriter.Close()
@@ -146,6 +148,8 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
ljLogger := &lumberjack.Logger{
Filename: filepath.Join(logDir, "coder-agent.log"),
MaxSize: 5, // MB
// Without this, rotated logs will never be deleted.
MaxBackups: 1,
}
defer ljLogger.Close()
logWriter := &closeWriter{w: ljLogger}