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

Add a Syslog octet counting frame decoder. (RFC6587) #743

Closed
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@bernd
Member

bernd commented Oct 21, 2014

@bernd bernd self-assigned this Oct 21, 2014

@bernd bernd added this to the 0.92 milestone Oct 21, 2014

@bernd bernd added the inputs label Oct 21, 2014

@bernd

This comment has been minimized.

Member

bernd commented Oct 21, 2014

I started with a FrameDecoder and am now working on the transport integration.

@bernd bernd force-pushed the syslog-tcp-octet-counting branch from ac683e2 to 0f941b0 Oct 22, 2014

@Override
public String linkToDocs() {
return "";

This comment has been minimized.

@joschi

joschi Oct 23, 2014

Contributor

This could link to http://www.graylog2.org/resources/documentation/sending/syslog but we'd need to add a section about syslog-ng and maybe a section on how to create a Syslog Input in Graylog2 to that document.

}
@Override
public ConfigurationRequest getRequestedConfiguration() {

This comment has been minimized.

@joschi

joschi Oct 23, 2014

Contributor

Why override this method at all? It's literally just calling super.getRequestedConfiguration().

@bernd bernd force-pushed the syslog-tcp-octet-counting branch from 0f941b0 to b8a3a8f Oct 23, 2014

private boolean usesOctetCountFraming(MessageEvent e) {
final ChannelBuffer message = (ChannelBuffer) e.getMessage();
return Character.isDigit(message.getByte(0));

This comment has been minimized.

@joschi

joschi Oct 23, 2014

Contributor

Could the ChannelBuffer ever be empty? If it can, this could throw an IndexOutOfBoundsException.

This comment has been minimized.

@joschi

joschi Oct 23, 2014

Contributor

While it's rather unlikely to happen here, Character#isDigit(char) matches much more than just [0-9]. Maybe rather use return '0' <= message.getByte(0) && message.getByte(0) <= '9'; instead.

@joschi

This comment has been minimized.

Contributor

joschi commented Oct 24, 2014

LGTM! 👍

@bernd bernd force-pushed the syslog-tcp-octet-counting branch from 29c8d8f to 21ee772 Oct 24, 2014

@bernd

This comment has been minimized.

Member

bernd commented Oct 24, 2014

Merged via squash commit 6a77e02.

@bernd bernd closed this Oct 24, 2014

@bernd bernd deleted the syslog-tcp-octet-counting branch Oct 24, 2014

bernd referenced this pull request Oct 24, 2014

Add a Syslog octet counting frame decoder. (RFC6587)
See: http://tools.ietf.org/html/rfc6587#section-3.4.1

Autodetect framing type to transparently support both methods on the
same input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment