-
Notifications
You must be signed in to change notification settings - Fork 10
Rename log-parser to query and improve usability #208
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Daiki Ueno <[email protected]>
It is a common use-case to monitor cryptographic usage on the system at real time. This adds a dedicated CLI tool, crau-monitor, by combining the functionalities of event-broker and client. Unlike those, crau-monitor doesn't require any system service but directly reads the log file. Signed-off-by: Daiki Ueno <[email protected]>
Signed-off-by: Daiki Ueno <[email protected]>
Signed-off-by: Daiki Ueno <[email protected]>
Signed-off-by: Daiki Ueno <[email protected]>
Signed-off-by: Daiki Ueno <[email protected]>
| let log_file = std::fs::File::open(&cli.log_path) | ||
| .with_context(|| format!("unable to read file `{}`", cli.log_path.display()))?; | ||
| let config = config::Config::new()?; | ||
| Pager::new().setup(); |
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.
Should we use Pager::new().skip_on_notty().setup()? I'm surprised is not the default.
| let inotify_stream = inotify.into_event_stream(buffer)?; | ||
| let watch_descriptor = inotify_stream | ||
| .watches() | ||
| .add(&log_file, WatchMask::MODIFY | WatchMask::CREATE) |
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.
same CREATE concern as in #206. hope there's some crate where it's already implemented, cause it feels quite involved. separate issue for the future?
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.
https://github.com/aravindavk/logwatcher/blob/master/src/lib.rs, except with a notify on the parent instead of sleeping?
| if !self.all_contexts.contains_key(group.context()) { | ||
| // Either this library did not do a new_context for this context, or the | ||
| // log we have is truncated at the beginning. Just assume that this context | ||
| // has no parent and create a new one so we don't loose the information in |
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.
s/loose/lose/
| ) | ||
| .required(false) | ||
| .value_parser(value_parser!(PathBuf)) | ||
| .default_value("audit.cborseq"), |
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.
remove default_value?
This renames crau-log-parser to crau-query, and attempts to add the following usability improvements:
--sinceand--untiloption to filter events by date (TODO)Fixes: #154