Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is to avoid gigabytes of logs in /tmp? Perhaps a comment for posterity and to avoid regressions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it correctly rotates logs at 5mb but it leaves the old logs around forever without this.

}
defer logWriter.Close()

Expand Down Expand Up @@ -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}
Expand Down