dwbutler / logstash-logger

Ruby logger that writes logstash events
MIT License
456 stars 118 forks source link

Skip message truncating when there is no message field #130

Closed esergion closed 7 years ago

esergion commented 7 years ago

Hi guys! I was faced with the following problem: I'm sending messages and pure JSON objects through UDP, and sometimes some messages can be very large. So i've decided to use max_message_size option but i've encountered another problem:

Failure/Error: event['message'.freeze] = event['message'.freeze].byteslice(0, LogStashLogger.configuration.max_message_size)

     NoMethodError:
       undefined method `byteslice' for nil:NilClass
     # ./lib/logstash-logger/formatter/base.rb:61:in `build_event'
     # ./lib/logstash-logger/formatter/base.rb:18:in `call'

cause there is no message-field in the JSON-objects.

dwbutler commented 7 years ago

Released in 0.25.1.