-
Notifications
You must be signed in to change notification settings - Fork 72
feat: support systemd-journal logging #1858
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: master
Are you sure you want to change the base?
feat: support systemd-journal logging #1858
Conversation
|
Hi @felfert Thanks for the patch. We're currently focused on a roadmap to provide docker images for releases which should make deployment and maintenance a lot easier for folks. That would mean the logging would typically be taken care of by docker/k8s automatically. I'm expecting that to cover most of the self-hosting crowd and would let us avoid adding these additional dependencies. Do you have a use case that wouldn't be able to use a container and would need this? Cheers |
Well, IMHO it's more like a matter of personal taste. I have packaged syncstorage-rs as rpm for Fedora and RHEL (Ubuntu&Debian in the works) and regarding ease of setup, those are even simpler than dealing with containers. Especially on cheap vhosts with LAMP-stacks where you have mysql/mariadb and apache available by default. If you worry about the dependencies, I could add a feature. So: Regards |
|
Sorry for the delay here. I'm inclined to find a way to land this. We have it on our list to review this sprint. |
| .map(|stat| format!("{}:{}", stat.st_dev, stat.st_ino)) | ||
| .ok() | ||
| .and_then(|stderr| { | ||
| std::env::var_os("JOURNAL_STREAM").map(|s| s.to_string_lossy() == stderr.as_str()) | ||
| }) |
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.
You can compare the bytes directly instead of doing to_string_lossy()
| use std::os::fd::AsFd; | ||
|
|
||
| fn connected_to_journal() -> bool { | ||
| rustix::fs::fstat(std::io::stderr().as_fd()) |
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.
Since systemd is linux only you could drop rustix and use MetadataExt to get the information from std::fs::metadata("/dev/stderr"). It's mildly annoying that you can't stat the fd directly, but AFAIK they should be equivalent.
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.
👍 and without rustix, there's really no reason for needing to wrap this under a feature flag
Description
This PR adds support for native systemd-journal logging if running under systemd.
Benefits
Testing
Done manually by running syncserver in a systemd-service and then observing the log with journalctl