Class: Lumberjack::DataDogDevice

Inherits:
JsonDevice
  • Object
show all
Defined in:
lib/lumberjack_data_dog_device.rb

Overview

This Lumberjack device logs output to another device as JSON formatted text that maps fields to the standard JSON payload for DataDog log collection.

See docs.datadoghq.com/logs/log_collection

Defined Under Namespace

Modules: ExceptionHash Classes: DataDogTagsFormatter, DurationFormatter, MessageExceptionFormatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream_or_device, backtrace_cleaner: nil, max_message_length: nil) ⇒ DataDogDevice

Returns a new instance of DataDogDevice.



141
142
143
144
145
# File 'lib/lumberjack_data_dog_device.rb', line 141

def initialize(stream_or_device, backtrace_cleaner: nil, max_message_length: nil)
  super(stream_or_device, mapping: data_dog_mapping)
  self.backtrace_cleaner = backtrace_cleaner
  self.max_message_length = max_message_length
end

Instance Attribute Details

#backtrace_cleanerObject

You can specify a backtrace cleaner that will be called with exception backtraces before they are added to the payload. You can use this to remove superfluous lines, compress line length, etc. One use for it is to keep stack traces clean and prevent them from overflowing the limit on the payload size for an individual log entry.



135
136
137
# File 'lib/lumberjack_data_dog_device.rb', line 135

def backtrace_cleaner
  @backtrace_cleaner
end

#max_message_lengthObject

You can specify a limit on the message size. Messages over this size will be split into multiple log entries to prevent overflowing the limit on message size which makes the log entries unparseable.



139
140
141
# File 'lib/lumberjack_data_dog_device.rb', line 139

def max_message_length
  @max_message_length
end