[systemd-devel] [RFC/PATCH] journal over the network

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Nov 18 16:21:57 PST 2012


Hi,

this is a stab at the "remote journal logging" functionality... Attached
is the body of the program, but full patch set is available under
   http://in.waw.pl/git/systemd/ journal-remoted

The program (called systemd-journal-remoted now, but I'd be happy to
hear suggestions for a better name) listens on sockets (either from
socket activation, or specified on the command line with --listen=),
or reads stdin (if given --stdin), or uses curl to receive events from
a systemd-journal-gatewayd instance (with --url=). So it can be used
a server, or as a standalone binary.

Messages must be in the export format. They are parsed and stored
into a journal file. The journal file is /var/log/journal/external-*.journal
by default, but this can be overridden by commandline options (--output).

Authentication and rate-limiting are not implemented...

Debugging messages are a bit excessive...

Push mode is not implemented... (but it would be a separate program
anyway).

Examples:
  journalctl -o export | systemd-journal-remoted --stdin -o /tmp/dir/
will create a copy of events, which can be browsed with
  journalctl -D /tmp/dir/

Copy messages from another host
  systemd-journal-remoted --url http://some.host:19531/entries?boot' -o /tmp/dir/

Copy messages from another host, live
  systemd-journal-remoted --url http://some.host:19531/entries?boot&follow' -o /tmp/dir/

Listen on socket:
  systemd-journal-remoted --listen 19532 -o /tmp/dir/

I think that the implementation is fairly sound, but some details
certainly can be improved. E.g. currently, file names look like
(underneath some directory):

  remote-127.0.0.1~2000.journal
  remote-multiple.journal
  remote-stdin.journal
  remote-http~~~some~host~19531~entries.journal

The goal was to have names containing the port number, so that it is
possible to run multiple instances without conflict.

Also, the memory allocation/deallocation patterns in get_line() are
fairly ugly. I'm not sure if this is significant at all.

Zbyszek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: journal-remoted.c
Type: text/x-csrc
Size: 40135 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20121119/ee8649a6/attachment-0001.c>


More information about the systemd-devel mailing list