Class: Bosh::Agent::Platform::Linux::Logrotate

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh_agent/platform/linux/logrotate.rb

Constant Summary collapse

DEFAULT_MAX_LOG_FILE_SIZE =
"50M"

Instance Method Summary collapse

Constructor Details

#initialize(template_dir) ⇒ Logrotate

Returns a new instance of Logrotate.



7
8
9
10
11
# File 'lib/bosh_agent/platform/linux/logrotate.rb', line 7

def initialize(template_dir)
  @logger = Bosh::Agent::Config.logger
  @template_src = File.join template_dir, "logrotate.erb"
  @template_dst = File.join Bosh::Agent::Config.system_root, "etc", "logrotate.d", BOSH_APP_GROUP
end

Instance Method Details

#install(spec = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bosh_agent/platform/linux/logrotate.rb', line 13

def install(spec={})
  # These local variables are used in the template context
  # (see Bosh::Agent::Template class implementation)
  base_dir = Bosh::Agent::Config.base_dir
  size = max_log_file_size(spec['properties'])
  @logger.debug "Compiling template #@template_src to #@template_dst"
  Template.write do |t|
    t.src @template_src
    t.dst @template_dst
  end
end