mcuadros / go-syslog

Syslog server library for go.
http://godoc.org/gopkg.in/mcuadros/go-syslog.v2
MIT License
523 stars 143 forks source link

Extend the Handler interface to report message length and parsing errors. #8

Closed emmanuel closed 9 years ago

emmanuel commented 9 years ago

I'm updating otoolep/syslog-gollector to use mcuadros/go-syslog (and thus jeromer/syslogparser) in lieu of the current regex-based parser and TCP/UDP server implementation. One of the things I quite like about syslog-gollector is the stats (using go-metrics): messages received, bytes received, num messages successfully parsed and num messages that failed to parse.

AFAICT, in order to collect those stats, my best options is to get 1) info at the Handler interface. Either that, or 2) I would need to instrument deeper within mcuadros/go-syslog, which seems less good™. This pull request represents my attempt at implementing 1.

emmanuel commented 9 years ago

Oops. My initial push was a broken version. I'm hoping Travis CI picks up the change despite it being a forced push... if not I suppose I'll create another pull request.

mcuadros commented 9 years ago

Thanks for the request Can you improve a bit the test? To assert that the error and size is properly delivered to the handler?

emmanuel commented 9 years ago

@mcuadros – just pushed updates to server_test.go to verify the size and error are delivered to the Handler. Also, I fixed the breakage I introduced into handler_test.go :frowning:.

mcuadros commented 9 years ago

Thx