log icon indicating copy to clipboard operation
log copied to clipboard

Add Logentries handler.

Open hwrdprkns opened this issue 7 years ago • 12 comments

This handler will report to LogEntries with a TCP token.

hwrdprkns avatar Dec 13 '16 19:12 hwrdprkns

image

hwrdprkns avatar Dec 13 '16 19:12 hwrdprkns

@tj @phacops - ping

hwrdprkns avatar Dec 13 '16 19:12 hwrdprkns

Hey, this would be useful to me. Is there any chance of this being upstreamed soon?

cc: @tj

jchv avatar Jan 25 '17 20:01 jchv

hmm weird I thought I commented on this one, added

tj avatar Jan 25 '17 21:01 tj

LGTM other than the potentially superfluous Close

tj avatar Jan 25 '17 21:01 tj

@tj @johnwchadwick - Just rebased - a review would be great. I imagine in long running situations the HandleLog function could return an error if the socket gets closed or borked. May have to call NewLogHandler in that case.

hwrdprkns avatar Jan 25 '17 21:01 hwrdprkns

@johnwchadwick care to check it out? I don't use logentries

tj avatar Jan 25 '17 23:01 tj

Oh, I think the current code is probably sufficient. The le_go library does ensure the TCP socket is open and will attempt to reconnect if not, and if that fails it will return an error.

That being said, I definitely think the Close is superfluous. In fact, if it weren't for the fact that le_go ensures the socket is open, that defer Close would probably cause a problem since it runs before the handler is even returned from the constructor.

jchv avatar Jan 26 '17 02:01 jchv

yep, cool. I'll tweak a few things and get that in tomorrow. We're missing comments and the style is a bit different than the others (they all use New() for ex). OCD but hey haha, I like keeping things consistent.

tj avatar Jan 26 '17 02:01 tj

Please add comments to your content!

hwrdprkns avatar Jan 26 '17 02:01 hwrdprkns

Hmm. I'm running some tests with this in a close-to-production environment and I actually see some issues with the reliability. It seemed to arbitrarily disconnect silently and not reconnect. It's kind of strange given that bsphere/le_go seems to have it's own reconnection logic.

Well, YMMV. I may try to roll a version that doesn't have external dependencies for my own usage, since the LE protocol is pretty braindead-simple anyways.

jchv avatar Jan 27 '17 18:01 jchv

And, now I've done that. My LogEntries handler is available here. Of course, there's no guarantee that my implementation of the LogEntries protocol is better than bsphere/le_go. I did it because I am experiencing issues in my environment and because I wanted more control. That being said, if there's ever any interest in upstreaming this version, let me know.

jchv avatar Jan 27 '17 21:01 jchv