gemnasium / logrus-graylog-hook

Graylog hook for logrus
MIT License
87 stars 63 forks source link

interface for compression type #10

Closed cha-won closed 8 years ago

cha-won commented 8 years ago

Hi. first of all thanks for providing graylog hook. it's pretty help for me

i suggest you a feature (this requires little bit change i guess)

currently there is no option to set compression type and i believe the compression is important feature of GELF format specification.

i found that the struct has gelf.Writer as a member that has a interface for setting the compression type but it's not accessible from outside.

type GraylogHook struct { Facility string Extra map[string]interface{} gelfLogger *gelf.Writer buf chan graylogEntry wg sync.WaitGroup mu sync.RWMutex synchronous bool }

if you replace the first character 'g' of "gelfLogger" with "G" , all problems are solved cause user can access directly to gelf.writer configuration or maybe you can add some gelf.writer configurable interface in GraylogHook.

please consider it.

thanks.

gravis commented 8 years ago

I will integrate that in the upcoming v2 of this plugin. Thanks for the suggestion!

gravis commented 8 years ago

Could you test the v2.0.0 branch please? I will merge and tag it in a few days, once it was tested in real conditions. Thanks

cha-won commented 8 years ago

ok, i'll test it on working day. thanks

cha-won commented 8 years ago

ok, here is the result. for the Gzip type, it works well. but zlib doesn't. a message compressed by zlib reaches graylog but is not indexed in ES without any ERR msg of graylog. i think it's a problem of graylog writer's. thanks

gravis commented 8 years ago

What compression do you use? I've checked https://github.com/SocialCodeInc/go-gelf/blob/master/gelf/writer.go and the same method is used, except it defaults to zlib.DefaultCompression. The problem could either:

I'll try to take a look this week on my side.

gravis commented 8 years ago

Could you try with the master branch, after exposing the Gelf Writer, so you would be able to modify it directly. As it's using this one: https://github.com/SocialCodeInc/go-gelf/blob/master/gelf/writer.go we'll see if the pb is coming from the vendored writer or not. Thanks