Skip to content

Conversation

njuptlzf
Copy link

I realized Lumberjack in the audit module of Kubernetes.

When the file is deleted, it needs to be recreated without restarting the process to ensure that the log is not lost.

@njuptlzf
Copy link
Author

PTAL @natefinch

@natefinch
Copy link
Owner

I don't really want to incur the overhead of doing an os.stat on every single write.

A better way to do this is to handle the error when you try to write to a file that's been deleted. They way the only overhead is when the file is actually missing.

@njuptlzf
Copy link
Author

I don't really want to incur the overhead of doing an os.stat on every single write.

A better way to do this is to handle the error when you try to write to a file that's been deleted. They way the only overhead is when the file is actually missing.
This sounds correct.
I noticed that many log libraries do not have this kind of log file loss judgment. Can you share your opinion on this?
For the time being I only think of goroutine, not sure if lumberjack is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants