LOGSTASH-926 1st attempt

Hi,

Regarding the feature request I have filled LOGSTASH-926, I tried to implement this feature.

Please send any comment to improve this code. I don't do a lot of devs and it is my first code in ruby.

I hope it could be useful.

Sincerely yours, Mathieu.