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

Syslog appender #26

Closed
wants to merge 20 commits into from
Closed

Syslog appender #26

wants to merge 20 commits into from

Conversation

alygin
Copy link

@alygin alygin commented Jun 25, 2016

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 make Encoder 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.

@alygin alygin mentioned this pull request Jun 25, 2016
@sfackler
Copy link
Collaborator

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

@alygin
Copy link
Author

alygin commented Sep 10, 2016

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.

@sfackler
Copy link
Collaborator

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.

@alygin
Copy link
Author

alygin commented Sep 10, 2016

Sure. There must be a better way to make syslog available in log4rs.

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.

2 participants