Class: FFluentdLine

Inherits:
Object
  • Object
show all
Defined in:
lib/rforward/ffluentd_line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFFluentdLine

Returns a new instance of FFluentdLine.



6
7
8
# File 'lib/rforward/ffluentd_line.rb', line 6

def initialize
  @client = Config.resolve Config::FLUENTD
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/rforward/ffluentd_line.rb', line 4

def client
  @client
end

#hostObject

Returns the value of attribute host.



4
5
6
# File 'lib/rforward/ffluentd_line.rb', line 4

def host
  @host
end

#portObject

Returns the value of attribute port.



4
5
6
# File 'lib/rforward/ffluentd_line.rb', line 4

def port
  @port
end

#tagObject

Returns the value of attribute tag.



4
5
6
# File 'lib/rforward/ffluentd_line.rb', line 4

def tag
  @tag
end

Instance Method Details

#call(line) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/rforward/ffluentd_line.rb', line 10

def call line
  json = JSON.parse line
  @client.post Config.instance[:tag], json
  true
rescue Exception => e
  RLogger.instance.error "(#{e.message}) (line: #{line})"
  false
end