Created
November 16, 2012 07:06
-
-
Save tmikoss/4084993 to your computer and use it in GitHub Desktop.
Capistrano recipes for remote log viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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