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

Support for rfc3164 variants which lack the host name #12

Merged
merged 2 commits into from
Sep 6, 2016

Conversation

ijc
Copy link
Contributor

@ijc ijc commented Jun 30, 2016

The busybox syslogd produces syslog messages like this:

<30>Jun 23 13:17:42 chronyd[1119]: Selected source 192.168.65.1

because it forwards the /dev/log datagram as is and this does not include the hostname field.

To support this case I have added a method to set the hostname the parser should use which can then be called before parsing. The idea being that the caller can know something like this by looking at the incoming network connection (and perhaps doing a reverse DNS lookup). I think this is what the comment in the busybox code is sort of implying (i.e. the hostname could be a lie, so the receiver should probably make up their own mind)

Perhaps this really ought to be a new (rfc3164busybox? rfc3164devlog?) package, but that seems like an awful lot of code duplication for such a simple change.

The first patch fixes up the test suite, I also added a new test case to cover the new behaviour. Everything passes for me.

Ian Campbell added 2 commits June 23, 2016 14:32
This field was added in 72655c1c2bb3 ("Add support for local timezones in
RFC3164 parsing") but this was not reflected in the test suite.

Signed-off-by: Ian Campbell <[email protected]>
The busybox syslogd does this when logging over the network.

This cannot be autodetected, but allow a caller which is aware it is dealing
with this format to prepopulate a hostname and skip that token when parsing.

Adjust the toplevel Parse to only skip a character after parseHeader if it is a
space, since parseHostname now does not always skip to the next space.

Signed-off-by: Ian Campbell <[email protected]>
@jeromer jeromer merged commit 0e4ae46 into jeromer:master Sep 6, 2016
@jeromer
Copy link
Owner

jeromer commented Sep 6, 2016

Thanks for the patch. Sorry for being so late I did not receive any notification for your PR

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