-
Notifications
You must be signed in to change notification settings - Fork 64
log rotation #48
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
Merged
Merged
log rotation #48
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
579d924
hourly log rotation
c1f6e6f
prefix
b144c26
implemente log rotation
2fcee1f
add logs.prefixes
d0c16be
merge main
79d6806
fmt
894a115
move to logs
c19f788
comments
e7859ba
utils
b9dda75
handle guard
fa63571
remove unused deps
47a8ac8
default log location if not specified in configuration
c55d42f
as discussed
9ebe941
constants
d063d02
config
3922b80
names for modules
9878b85
rolling duration
c0adfaf
env var
9b20bfd
lint, remove hard coded strings
acab1b1
debug
32c4d13
stuff
6939733
change duration
4bf6cb9
change CB_BASE_LOG_PATH
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| use std::{ | ||
| fmt::{Display, Formatter}, | ||
| path::PathBuf, | ||
| }; | ||
|
|
||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[derive(Clone, Debug, Deserialize, Serialize)] | ||
| pub struct LogsSettings { | ||
| #[serde(default)] | ||
| pub duration: RollingDuration, | ||
| #[serde(default, rename = "host-path")] | ||
| pub host_path: PathBuf, | ||
| #[serde(default, rename = "rust-log")] | ||
| pub rust_log: String, | ||
| } | ||
|
|
||
| impl Default for LogsSettings { | ||
| fn default() -> Self { | ||
| Self { | ||
| duration: RollingDuration::Hourly, | ||
| host_path: "/var/logs".into(), | ||
| rust_log: "info".to_string(), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(Clone, Debug, Deserialize, Serialize)] | ||
| #[serde(rename_all = "lowercase")] | ||
| pub enum RollingDuration { | ||
| Minutely, | ||
| Hourly, | ||
| Daily, | ||
| Never, | ||
| } | ||
|
|
||
| impl Display for RollingDuration { | ||
| fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
| match self { | ||
| RollingDuration::Minutely => write!(f, "minutely"), | ||
| RollingDuration::Hourly => write!(f, "hourly"), | ||
| RollingDuration::Daily => write!(f, "daily"), | ||
| RollingDuration::Never => write!(f, "never"), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl Default for RollingDuration { | ||
| fn default() -> Self { | ||
| Self::Daily | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| pub const PBS_MODULE_NAME: &str = "pbs"; | ||
| pub const SIGNER_MODULE_NAME: &str = "signer"; | ||
| pub const BUILDER_LOG_NAME: &str = "builder_log"; | ||
| pub const CUSTOM_BOOST_NAME: &str = "custom_boost"; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
let's remove these as they are just examples. For external modules, we should use the module id from the module config. Let's move
PBS_MODULE_NAMEandSIGNER_MODULE_NAMEtoconfig/log.rs