Skip to content
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

Add support for reading from the system journal #40

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jabedude
Copy link
Contributor

@jabedude jabedude commented Dec 7, 2019

Closes #39.

This is a draft PR for adding support for reading from systemd's journal in pure rust.

@jabedude
Copy link
Contributor Author

jabedude commented Dec 9, 2019

@lucab could you let me know if this looks like it’s on the right track to you?

@jabedude
Copy link
Contributor Author

@lucab just checking back in to see if you have a moment to give any feedback 😊

}

impl SdJournal {
pub fn open_journal<P: AsRef<Path>>(path: P) -> Result<Self> {
Copy link
Owner

Choose a reason for hiding this comment

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

I think there is a bit of API mismatch here. To the best of my knowledge, the C API never works on a single file in isolation. I think the closest to this is sd_journal_open_files, which would take a slice of paths instead.

Perhaps we should start with an implementation of sd_journal_open_files_fd instead, and build the other ones of top of that?


#[test]
fn test_sdjournal_iter_simple() {
let sd = SdJournal::open_journal("./tests/user-1000.journal").unwrap();
Copy link
Owner

Choose a reason for hiding this comment

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

Can we make this file a bit smaller, just containing a few entry objects?

@lucab
Copy link
Owner

lucab commented Dec 16, 2019

@jabedude I went through you repo, lots of good stuff! But also a lot of things to read on my side :)

How do you want to proceed on this? Can we slowly move code over here? I'm happy to review if it can be split in a few human-sized chunks.

@jabedude
Copy link
Contributor Author

@lucab thanks for the feedback! As for how to proceed: I'm not sure to be honest. I went back and forth whether my repo should be merged into libsystemd-rs or if it should be standalone. I do think that it makes sense to move things over here.

One reason for keeping it standalone would be how to make the core code available if someone wanted to say, re-implement systemd-journald in pure rust if that makes sense. Thoughts?

@ip1981
Copy link

ip1981 commented Apr 26, 2020

Maybe guard with a "feature"? :)

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.

Implement sd_journal_* functions?
3 participants