AppController/djinn.rb
# Collects all AppScale-generated logs from all machines, and places them in
# a tarball in the AppDashboard running on this machine. This enables users
# to download it for debugging purposes.
#
# Args:
#   secret: A String password that is used to authenticate SOAP callers.
Collects all AppScale-generated logs from all machines, and places them in
a tarball in the AppDashboard running on this machine. This enables users
to download it for debugging purposes.

A String password that is used to authenticate SOAP callers.
Collects all AppScale - generated logs from all machines and places them in a tarball in the AppDashboard running on this machine . This enables users to download it for debugging purposes . A String password that is used to authenticate SOAP callers .
def gather_logs(secret)
    return BAD_SECRET_MSG unless valid_secret?(secret)
    uuid = HelperFunctions.get_random_alphanumeric()
    Djinn.log_info("Generated uuid #{uuid} for request to gather logs.")
    Thread.new {
      local_log_dir = "#{Dir.tmpdir}/#{uuid}"
      remote_log_dir = "/var/log/appscale"
      FileUtils.mkdir_p(local_log_dir)
      @nodes.each { |node|
        this_nodes_logs = "#{local_log_dir}/#{node.private_ip}"
        FileUtils.mkdir_p(this_nodes_logs)
        Djinn.log_run("scp -r -i #{node.ssh_key} -o StrictHostkeyChecking=no " +
          "2>&1 root@#{node.private_ip}:#{remote_log_dir} #{this_nodes_logs}")
      }
      dashboard_log_location = "#{HelperFunctions.get_app_path(AppDashboard::APP_NAME)}/app/static/download-logs/#{uuid}.tar.gz"
      Djinn.log_info("Done gathering logs - placing logs at " +
        dashboard_log_location)
      Djinn.log_run("tar -czf #{dashboard_log_location} #{local_log_dir}")
      FileUtils.rm_rf(local_log_dir)
    }
    return uuid
  end
def gather_logs ( secret ) return BAD_SECRET_MSG unless valid_secret? ( secret ) uuid = HelperFunctions . get_random_alphanumeric ( ) Djinn . log_info ( "Generated uuid #{uuid} for request to gather logs." ) Thread . new { local_log_dir = "#{Dir.tmpdir}/#{uuid}" remote_log_dir = "/var/log/appscale" FileUtils . mkdir_p ( local_log_dir ) @nodes . each { | node | this_nodes_logs = "#{local_log_dir}/#{node.private_ip}" FileUtils . mkdir_p ( this_nodes_logs ) Djinn . log_run ( "scp -r -i #{node.ssh_key} -o StrictHostkeyChecking=no " + "2>&1 root@#{node.private_ip}:#{remote_log_dir} #{this_nodes_logs}" ) } dashboard_log_location = "#{HelperFunctions.get_app_path(AppDashboard::APP_NAME)}/app/static/download-logs/#{uuid}.tar.gz" Djinn . log_info ( "Done gathering logs - placing logs at " + dashboard_log_location ) Djinn . log_run ( "tar -czf #{dashboard_log_location} #{local_log_dir}" ) FileUtils . rm_rf ( local_log_dir ) } return uuid end
Collects all AppScale-generated logs from all machines, and places them in
a tarball in the AppDashboard running on this machine.
Collects all AppScale - generated logs from all machines and places them in a tarball in the AppDashboard running on this machine .
# Begin by copying logs on all machines to this machine. # Next, tar.gz it up in the dashboard app so that users can download it.
secret
<not_specific>