[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MirageOS-devel] syslog reporter



hello,

since the bits and pieces were already in place (thanks to various
contributors), I implemented a syslog reporter [0] for the logs library [1].

I wrote the same functionality in pure Unix (with no dependencies apart
from syslog-message[2], result, ptime, and logs) using UDP and TCP as
transport, Lwt using UDP, TCP and TLS (including mutual authentication!)
as transport, and MirageOS using UDP, TCP and TLS as transport.  The
MirageOS bits are developed against the current mirage-dev repository.
To preserve proper layering, syslog does not resolve any hostnames using
DNS.

The idea of the reporter is that you create and register it as the logs
reporter, and it manages its own TCP/TLS stream (in UDP it uses sendto)
- if the connection is terminated for some reason, attempts are done to
re-establish a new connection (might should do exponential backoff
timers).  On error while re-connecting, log messages are printed on
standard error.

I tested interoperability with syslogd via UDP, nc via TCP, and openssl
s_server for the TLS bits.

I encountered a resource leakage - the TCP/TLS stream is never closed.
On program exit this should not be an issue (the kernel cleans that up
anyways), but in the case that another reporter is registered via
{!Logs.set_reporter}, I'd like to close the TCP/TLS stream (but there is
no way AFAICS).

It was an interesting experience to use the three different effectful
libraries for the same problem.  Turns out, Unix is the most
straightforward since it uses only exceptions, whereas in Lwt there is
need for Lwt.catch all over the place.  MirageOS lacks the ability to
print error messages in a uniform way (but we are aware of that and are
in the process of fixing it).  Look at the code yourself.

Integration into the mirage tool itself is not yet done (shouldn't be
too hard) - my idea is to not buffer any messages and send those from
bootup to the log host once we have a UDP layer, but just start sending
syslog messages once we have a UDP/TCP/TLS layer and print the previous
ones to a potential console.

Another action item would be to get RFC5424 syslog format (first in
syslog-message[2]).

Constructive feedback is as usual welcome (e.g. can I recover sanely
from any other socket error apart from EAGAIN? should I have a catchall
for exceptions while calling Unix/Lwt_unix.send/to (it would be bad for
logs-syslog to kill the entire application only because some send failed)?),

hannes


0: https://hannesm.github.io/logs-syslog/doc/Logs_syslog.html
  repository: https://github.com/hannesm/logs-syslog
  example code for lwt/unix/lwt-tls at the bottom of the individual files
  example unikernel
https://github.com/hannesm/logs-syslog/tree/master/example
1: http://erratique.ch/software/logs
2: https://github.com/verbosemode/syslog-message

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.