lib/logstash/plugin_mixins/event_support.rb
# Move all event data under given namespace (prefix).
#
# All field mappings, except for internal keys such as @timestamp and @metadata,
# will be moved under a target namespace e.g.
#
#   'foo' => 'bar'  ->  '[target][foo]' => 'bar'
#
# @note The passed event gets modified in place.
Move all event data under given namespace (prefix).
All field mappings, except for internal keys such as @timestamp and @metadata,
will be moved under a target namespace e.g.


Move all event data under given namespace ( prefix ) . All field mappings except for internal keys such as @timestamp and @metadata will be moved under a target namespace e . g .
def move_event_data(event, target_namespace)
        return if target_namespace.nil? || target_namespace.empty?
        event_data = event.to_hash
        empty_proto = LogStash::Event.new '@timestamp' => event.timestamp
        empty_proto.cancel if event.cancelled?
        event_data.reject! do |key, val|
          if key.start_with?('@')
            empty_proto.set(key, val) || true
          end
        end
        event.overwrite(empty_proto)
        event.set(target_namespace, event_data)
      end
def move_event_data ( event , target_namespace ) return if target_namespace . nil? || target_namespace . empty? event_data = event . to_hash empty_proto = LogStash :: Event . new '@timestamp' => event . timestamp empty_proto . cancel if event . cancelled? event_data . reject! do | key , val | if key . start_with? ( '@' ) empty_proto . set ( key , val ) || true end end event . overwrite ( empty_proto ) event . set ( target_namespace , event_data ) end
Move all event data under given namespace (prefix).
Move all event data under given namespace ( prefix ) .
event
target_namespace
note
The passed event gets modified in place.
The passed event gets modified in place .