-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Syslog appender #26
Syslog appender #26
Conversation
# Conflicts: # src/append/file/mod.rs
…to syslog-appender # Conflicts: # Cargo.toml
It seems like there's a lot of syslog specific stuff here that should probably live in some separate crate? This appears to maybe do what'd be needed? https://crates.io/crates/syslog |
Yeah, I had looked at that crate before writing my own implementation, but hadn't found an easy way to use it in log4rs. It wouldn't allow to leverage existing formatting and configuration facilities. I wanted this feature to work naturally within log4rs. But if you don't want to bring the syslog specific into this crate, I'll try to find a way to make it a separate module that can be only linked when needed. |
Ah right, it exposes its own logger. I'd still prefer if this used a separate crate that contained the syslog stuff to avoid having yet another private syslog implementation in the ecosystem. |
Sure. There must be a better way to make syslog available in log4rs. |
Please, check out this implementation of the syslog appender. For now, it works via UDP/TCP and supports plain and RFC 5424 messages, the detailed list of features and limitations can be found in the docs of the syslog module. Usage examples are also provided.
There's an issue that I'd like to discuss. I've tried a couple of ways to plug
Encode
into this module but failed to find a good enough solution to make it play well with network protocols. The current implementation requires mutability which is okay for files, console and TCP, but reduces the performance of UDP sockets that can be used concurrently with only write access. I don't think encoders is an absolute must have for syslog since it has its own message format standards (RFC 5424 and RFC 3164) but it surely would be good to support it. I think we could find some solution to makeEncoder
more friendly for appenders of various types after a refactoring (maybe in later versions). I left one of the implementations of the encoders support commented in the syslog module so you could quickly figure out what I've already tried and maybe find some good solution that I neglected.I could also implement automatic hostname and app-name computation but it will depend on some libc features that are only available in nightly. So I left them configurable for now.
Any feedback will be highly appreciated.