Skip to content

Conversation

@ueno
Copy link
Contributor

@ueno ueno commented Dec 12, 2025

This renames crau-log-parser to crau-query, and attempts to add the following usability improvements:

  • Print output through a pager
  • Add --since and --until option to filter events by date (TODO)
  • Add a way to take filtering expressions matching the key value pairs (TODO)

Fixes: #154

ueno added 6 commits December 12, 2025 19:34
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]>
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();
Copy link
Collaborator

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)
Copy link
Collaborator

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?

Copy link
Collaborator

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
Copy link
Collaborator

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"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove default_value?

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.

Simpler CLI

2 participants