Class: Bosh::Director::Jobs::FetchLogs

Inherits:
BaseJob show all
Includes:
LockHelper
Defined in:
lib/bosh/director/jobs/fetch_logs.rb

Instance Attribute Summary

Attributes inherited from BaseJob

#task_id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LockHelper

#with_compile_lock, #with_deployment_lock, #with_release_lock, #with_release_locks, #with_stemcell_lock

Methods inherited from BaseJob

#begin_stage, #dns_manager, #event_manager, #logger, perform, #result_file, schedule_message, #single_step_stage, #task_cancelled?, #task_checkpoint, #track_and_log, #username

Constructor Details

#initialize(instance_id, options = {}) ⇒ FetchLogs

Returns a new instance of FetchLogs.



12
13
14
15
16
17
18
19
20
21
# File 'lib/bosh/director/jobs/fetch_logs.rb', line 12

def initialize(instance_id, options = {})
  @instance_id = instance_id
  @log_type = options["type"] || "job"
  @filters = options["filters"]
  @instance_manager = Api::InstanceManager.new

  blobstore = options.fetch(:blobstore) { App.instance.blobstores.blobstore }
  log_bundles_cleaner = LogBundlesCleaner.new(blobstore, 60 * 60 * 24 * 10, logger) # 10 days
  @logs_fetcher = LogsFetcher.new(@instance_manager, log_bundles_cleaner, logger)
end

Class Method Details

.job_typeObject



8
9
10
# File 'lib/bosh/director/jobs/fetch_logs.rb', line 8

def self.job_type
  :fetch_logs
end

Instance Method Details

#performObject



23
24
25
26
27
# File 'lib/bosh/director/jobs/fetch_logs.rb', line 23

def perform
  instance = @instance_manager.find_instance(@instance_id)

  @logs_fetcher.fetch(instance, @log_type, @filters)
end