The original implementation of svlogd from smarden.org supports two
features that are not yet in the busybox version.

1. Send logs to UDP destination.
2. Prefix logs with a string.

This change implements these two features. The current implementation
has a few limitations.

* Only supports UDP destination as an additional log target. Logs are
still written to files.
* While sending logs to UDP destination, only the first 1000 characters
per line are send in a UDP message. If a log line is very long, UDP
message will be truncated.
* The max length of prefix string is 60 characters.

A few notes on the current implementation:
1. It seems that file logging has quite a few optimizations but hardly can
be applied to UDP send message. Now if UDP is enabled on at least one
config, file logging will only write one line at a time. UDP message
will only contain one line of log message. If UDP is not enabled in any
config, file logging will write multiple lines at a time.
2. The file logging buffer is refilled as soon as buffer write is
called. This doesn't cope with UDP message send because UDP send message
is called only after the entire payload is setup. A dedicated memory buffer
is created if UDP is enabled on at least one config. The UDP buffer is 1000
characters long. If a log line is longer than 1000 characters, the remaining
log of that line will not be in the UDP message.
3. Prefix is logged to file as a separate write. Prefix is added to a UDP
message via IOV to minimize buffer copying.

Hao Xiang (2):
  Support logging to UDP destinations.
  Support user specified prefix feature.

 runit/svlogd.c | 240 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 233 insertions(+), 7 deletions(-)

-- 
2.45.2

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to