Class: CFTools::Tunnel::WatchLogs

Inherits:
Base
  • Object
show all
Defined in:
lib/tools-cf-plugin/tunnel/watch-logs.rb

Constant Summary collapse

LOGS =
{
  "cloud_controller" => ["cloud_controller_ng/cloud_controller_ng.log"],
  "dea_next" => ["dea_next/dea_next.log"],
  "health_manager" => ["health_manager_next/health_manager_next.log"],
  "router" => ["gorouter/gorouter.log"]
}

Constants inherited from Base

Base::BOSH_CONFIG

Instance Method Summary collapse

Methods inherited from Base

#authenticate_with_director, #connected_director, #director, #login_to_director, #precondition, #tunnel_to

Instance Method Details

#watch_logsObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/tools-cf-plugin/tunnel/watch-logs.rb', line 22

def watch_logs
  director_host = input[:director]
  components = input[:components]
  gateway = input[:gateway]

  director = connected_director(director_host, gateway)

  deployment =
    with_progress("Getting deployment info") do
      current_deployment(director)
    end

  locations =
    with_progress("Finding logs for #{c(deployment["name"], :name)}") do
      locs = stream_locations(director, deployment["name"], components)

      if locs.empty?
        fail "No locations found."
      else
        locs
      end
    end

  stream = stream_for(director, deployment["name"], gateway)

  stream.stream(locations) do |entry|
    line pretty_print_entry(entry)
  end
end