# File lib/rhc/commands/tail.rb, line 18 def run(app_name) rest_app = rest_client.find_application(options.namespace, app_name, :include => :cartridges) ssh_url = options.gear ? rest_app.gear_ssh_url(options.gear) : rest_app.ssh_url tail('*', URI(ssh_url), options) 0 end
Application log file tailing
# File lib/rhc/commands/tail.rb, line 29 def tail(cartridge_name, ssh_url, options) debug "Tail in progress for cartridge #{cartridge_name}" host = ssh_url.host uuid = ssh_url.user file_glob = options.files ? options.files : "#{cartridge_name}/log*/*" remote_cmd = "tail#{options.opts ? ' --opts ' + Base64::encode64(options.opts).chomp : ''} #{file_glob}" ssh_cmd = "ssh -t #{uuid}@#{host} '#{remote_cmd}'" begin #Use ssh -t to tail the logs debug ssh_cmd ssh_ruby(host, uuid, remote_cmd) rescue warn "You can tail this application directly with:\n#{ssh_cmd}" raise end end