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

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

Closed
wants to merge 8 commits into from

Conversation

bernd
Copy link
Member

@bernd 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
Copy link
Member Author

bernd commented Oct 21, 2014

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


@Override
public String linkToDocs() {
return "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

private boolean usesOctetCountFraming(MessageEvent e) {
final ChannelBuffer message = (ChannelBuffer) e.getMessage();

return Character.isDigit(message.getByte(0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

joschi commented Oct 24, 2014

LGTM! 👍

@bernd
Copy link
Member Author

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 October 24, 2014 10:36
bernd referenced this pull request Oct 24, 2014
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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants