Add Logs_syslog_unix.unix_reporter and Logs_syslog_lwt.unix_reporter#5
Add Logs_syslog_unix.unix_reporter and Logs_syslog_lwt.unix_reporter#5hannesm merged 3 commits intohannesm:masterfrom
Conversation
Code for restoring connections factored out of tcp_reporter and a Unix domain sockets version added in unix_reporter.
|
There seems to be something up with Travis - I think the failing jobs just need restarting. |
src/logs_syslog_unix.mli
Outdated
| fails, the log message is reported to standard error, and attempts are made | ||
| to re-establish the connection. A syslog message is truncated to [truncate] | ||
| bytes and is framed according to the given [framing]. The default for | ||
| [truncate] is [65536] is [framing] is not provided and [0] otherwise. If |
There was a problem hiding this comment.
typo: second is in line 36 should be if
|
this looks good to me, but it diverges the unix and lwt backend. could I bother you to adjust the lwt backend in a similar fashion? once syslog-message is re-released, I'm happy to merge the first commit here |
Code for restoring connections factored out of tcp_reporter and a Unix domain sockets version added in unix_reporter.
|
A very good point - I've added an Lwt version, |
|
|
|
thanks, now that I merged #7, would you be so kind to rebase this PR? a pin to syslog-message in travis.yml is fine to be merged into this repository (and I'm sure @verbosemode will release syslog-message once verbosemode/syslog-message#18 is sorted) :) |
1bbc887 to
65bf80e
Compare
| | Error e -> Lwt.return (Error e) | ||
| | Ok () -> | ||
| let transmit = | ||
| if st = Unix.SOCK_DGRAM then |
There was a problem hiding this comment.
(sorry, was away from computer for a week, now slowly catching up on the PRs here -- thanks for them!)
I'm curious about the reasoning behind this conditional. Lwt_unix.send calls send(), which does in either case return the number of transmitted bytes. why is a partial write to a unix domain socket not handled here?
There was a problem hiding this comment.
There is the same thing in the normal unix version too. My (not necessarily correct) understanding is that a partial write would need the same kind of handling as in the UDP reporter (where the return from sendto is also ignored). The Unix domain socket is opened in datagram mode by default (with handling for if you happen to be on an either very old or weird system which does syslog in stream mode on /dev/log). Without framing, you can't write anything further on a partial write, since the other hand has no idea when the packet ends. So my understanding is that because we're connection-oriented, like TCP, means send is required and not sendto but, like UDP, there's not a lot we can do about a partial write.
Since the UDP case doesn't handle a partial write, I didn't put one here - perhaps it should be that both should do some error handling 🙂
.travis.yml
Outdated
| env: | ||
| global: | ||
| - PACKAGE="logs-syslog" | ||
| - PINS="syslog-message:git+https://github.com/verbosemode/syslog-message.git" |
There was a problem hiding this comment.
it's actually sufficient to have PINS="syslog-message" :)
|
thanks and sorry for the delay |
This PR adds the ability to connect to
/dev/logand post messages to the local syslog daemon.This is related to a PR in the syslog-message library, and I'd expect the second commit to be blown away (and the opam file updated) before merging.