Module: Fluentd::Agent::Common

Included in:
FluentdGem, Remote, TdAgent
Defined in:
app/models/fluentd/agent/common.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#extra_optionsObject (readonly)

Returns the value of attribute extra_options.



20
21
22
# File 'app/models/fluentd/agent/common.rb', line 20

def extra_options
  @extra_options
end

Instance Method Details

#config_fileObject



56
57
58
# File 'app/models/fluentd/agent/common.rb', line 56

def config_file
  extra_options[:config_file] || self.class.default_options[:config_file]
end

#errors_since(since = 1.day.ago) ⇒ Object



30
31
32
33
34
35
36
37
# File 'app/models/fluentd/agent/common.rb', line 30

def errors_since(since = 1.day.ago)
  errors = []
  logged_errors do |error|
    break if Time.parse(error[:subject]) < since
    errors << error
  end
  errors
end

#initialize(options = {}) ⇒ Object



22
23
24
# File 'app/models/fluentd/agent/common.rb', line 22

def initialize(options = {})
  @extra_options = options
end

#log_fileObject



52
53
54
# File 'app/models/fluentd/agent/common.rb', line 52

def log_file
  extra_options[:log_file] || self.class.default_options[:log_file]
end

#pid_fileObject



48
49
50
# File 'app/models/fluentd/agent/common.rb', line 48

def pid_file
  extra_options[:pid_file] || self.class.default_options[:pid_file]
end

#recent_errors(limit = 3) ⇒ Object



39
40
41
42
43
44
45
46
# File 'app/models/fluentd/agent/common.rb', line 39

def recent_errors(limit = 3)
  errors = []
  logged_errors do |error|
    errors << error
    break if errors.length >= limit
  end
  errors
end

#wait_process_starting_secondsObject



26
27
28
# File 'app/models/fluentd/agent/common.rb', line 26

def wait_process_starting_seconds
  10.seconds # wait time for fluentd pidfile created
end