Skip to content

Commit

Permalink
Raw events option to allow a fix Logstash 2.0 compatibility
Browse files Browse the repository at this point in the history
Related #247
  • Loading branch information
driskell committed Nov 8, 2015
1 parent 19b9af2 commit fb54c40
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/log-courier/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def get_json_parseerror

def initialize(options = {})
@options = {
logger: nil,
transport: 'tls',
logger: nil,
transport: 'tls',
raw_events: true,
}.merge!(options)

@logger = @options[:logger]
Expand Down Expand Up @@ -199,7 +200,7 @@ def process_jdat(message, comm, event_queue)

# Decode the JSON
begin
event = self.class.get_json_adapter.load(data_buf, :raw => true)
event = self.class.get_json_adapter.load(data_buf, :raw => @options[:raw_events])
rescue self.class.get_json_parseerror => e
@logger.warn e, :invalid_encodings => invalid_encodings, :hint => 'JSON parse failure, falling back to plain-text' unless @logger.nil?
event = { 'message' => data_buf }
Expand Down

0 comments on commit fb54c40

Please sign in to comment.