Class: Fluent::ScribeInput::FluentScribeHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/in_scribe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#add_prefixObject

Returns the value of attribute add_prefix.



109
110
111
# File 'lib/fluent/plugin/in_scribe.rb', line 109

def add_prefix
  @add_prefix
end

#msg_formatObject

Returns the value of attribute msg_format.



111
112
113
# File 'lib/fluent/plugin/in_scribe.rb', line 111

def msg_format
  @msg_format
end

#remove_newlineObject

Returns the value of attribute remove_newline.



110
111
112
# File 'lib/fluent/plugin/in_scribe.rb', line 110

def remove_newline
  @remove_newline
end

Instance Method Details

#Log(msgs) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/fluent/plugin/in_scribe.rb', line 113

def Log(msgs)
  begin
    msgs.each { |msg|
      record = create_record(msg)
      if @add_prefix
        Engine.emit(@add_prefix + '.' + msg.category, Engine.now, record)
      else
        Engine.emit(msg.category, Engine.now, record)
      end
    }
    return ResultCode::OK
  rescue => e
    $log.error "unexpected error", :error=>$!.to_s
    $log.error_backtrace
    return ResultCode::TRY_LATER
  end
end