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

[WIP] Add a Syslog input listening to UDP and TCP connection #6433

Closed
wants to merge 9 commits into from

Conversation

ph
Copy link
Contributor

@ph ph commented Feb 21, 2018

Not ready for review

This is just a placeholder PR, since hound is a bit of a pain to deal with I have disable it on this PR and will create a new PR when it's ready for review..

This commit add a new input named Syslog which can receive syslog
formated events from either UDP or TCP, currently without any SSL.
The events are locally parsed and send downstream.

The parser will support RFC3164 formatted events, the parser uses
state machines to parses the messages really fast instead of regular
expression.

The state machine are written using Ragel and that generate compact and
optimized go code, using state machine is a trade off of speed vs size
of the binary. This generated file add 32K to the final binary which is
an OK trade of.

Limitation:

Due to the nature of syslog, it's possible that some messages are not
correctly parsed, the parser is a work in progress and will benefit from
any bug report.

The best solution for them is to tag them and keep the message as the
raw message.

depends on #6266 and #6439

This commit add a new input named Syslog which can receive syslog
formated events from either UDP or TCP, currently without any SSL.
The events are locally parsed and send downstream.

The parser will support RFC3164 formatted events, the parser uses
state machines to parses the messages really fast instead of regular
expression.

The state machine are written using Ragel and that generate compact and
optimized go code, using state machine is a trade off of speed vs size
of the binary. This generated file add 32K to the final binary which is
an OK trade of.

Limitation:

Due to the nature of syslog, it's possible that some messages are not
correctly parsed, the parser is a work in progress and will benefit from
any bug report.

The best solution for them is to tag them and keep the `message` as the
raw message.
@ph ph added in progress Pull request is currently in progress. Filebeat Filebeat labels Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
return nil, nil
}

func (s SyslogMessage) IsValid() bool {

Choose a reason for hiding this comment

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

exported method SyslogMessage.IsValid should have comment or be unexported

s.second = sec
}

func (s SyslogMessage) Ts() (*time.Time, error) {

Choose a reason for hiding this comment

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

exported method SyslogMessage.Ts should have comment or be unexported

s.minute = h
}

func (s *SyslogMessage) Second(sec []byte) {

Choose a reason for hiding this comment

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

exported method SyslogMessage.Second should have comment or be unexported

s.hour = h
}

func (s *SyslogMessage) Minute(h []byte) {

Choose a reason for hiding this comment

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

exported method SyslogMessage.Minute should have comment or be unexported

s.day = d
}

func (s *SyslogMessage) Hour(h []byte) {

Choose a reason for hiding this comment

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

exported method SyslogMessage.Hour should have comment or be unexported

s.month = m
}

func (s *SyslogMessage) GetMonth() int {

Choose a reason for hiding this comment

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

exported method SyslogMessage.GetMonth should have comment or be unexported

return &SyslogMessage{}
}

func (s *SyslogMessage) Month(m []byte) {

Choose a reason for hiding this comment

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

exported method SyslogMessage.Month should have comment or be unexported

const syslog_en_main int = 1


//line parser.rl:8

Choose a reason for hiding this comment

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

comment on exported function Parse should be of the form "Parse ..."

const syslog_first_final int = 69
const syslog_error int = 0

const syslog_en_main int = 1

Choose a reason for hiding this comment

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

don't use underscores in Go names; const syslog_en_main should be syslogEnMain

//line parser.go:7
const syslog_start int = 1
const syslog_first_final int = 69
const syslog_error int = 0

Choose a reason for hiding this comment

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

don't use underscores in Go names; const syslog_error should be syslogError

@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@elastic elastic deleted a comment from houndci-bot Feb 21, 2018
@ph
Copy link
Contributor Author

ph commented Feb 21, 2018

This PR contains only the parser and the initial works for the input, I need to move #6361 forward for the UDP/TCP So I can reuse them as component in the Syslog input.

@@ -0,0 +1,1389 @@

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is generated code.. go away hound.

@ph ph mentioned this pull request Mar 27, 2018
@ph
Copy link
Contributor Author

ph commented Apr 6, 2018

Closing and reopening a new one since the UDP and TCP are now merged and it will be clearer without all the hound comments.

@ph ph closed this Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Filebeat Filebeat in progress Pull request is currently in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants