Skip to content

Instantly share code, notes, and snippets.

@tmikoss
Created November 16, 2012 07:06
Show Gist options
  • Save tmikoss/4084993 to your computer and use it in GitHub Desktop.
Save tmikoss/4084993 to your computer and use it in GitHub Desktop.
Capistrano recipes for remote log viewing
namespace :log do
desc "Search from log files on server"
task :grep, :roles => :app do
run "cd #{current_path}/log && grep #{ENV['str']} -B #{ENV['before'] || 5} -A #{ENV['after'] || 35} #{rails_env}.log*"
end
desc "Tail log files on servers"
task :tail, :roles => :app do
run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
puts "#{data}"
break if stream == :err
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment