-
Notifications
You must be signed in to change notification settings - Fork 260
Add support for log file rotation #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
sharmasushant
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should append timestamps to filenames when we start writing to the log file. When the file count goes beyond the limit, we should delete the file with oldest time stamp.
log/logger.go
Outdated
| const ( | ||
| logPrefix = "" | ||
| logFileExtension = ".log" | ||
| maxLogFileSize = 10 * 1024 * 1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxLogFileSizeInBytes
| logFileExtension = ".log" | ||
| maxLogFileSize = 10 * 1024 * 1024 | ||
| maxLogFileCount = 8 | ||
| rotationCheckFrq = 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add units here too, rotationCheckFreqInCalls
log/logger_linux.go
Outdated
| const logFilePerm = os.FileMode(0664) | ||
|
|
||
| const syslogTag = "AzureContainerNet" | ||
| const syslogTag = "azure-vnet-plugin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the old name was better because CNS is not a vnet-plugin.
sharmasushant
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good.
Rotates log files when they reach the size limit, keeps the last n files.