Created
March 25, 2011 06:24
-
-
Save mikhailov/886438 to your computer and use it in GitHub Desktop.
Capistrano extra recipes
This file contains 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 "A pinch of tail" | |
task :tailf, :roles => :app do | |
run "tail -n 10000 -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data| | |
puts "#{data}" | |
break if stream == :err | |
end | |
end | |
desc "Grep actions and highlight long time actions > 300ms" | |
task :grep_long, :roles => :app do | |
run "grep '^Completed' #{shared_path}/log/#{rails_env}.log | tail -n 1000 | perl -pe 's/Completed in ([3-9][0-9]{2,}|1[0-9]{3,})+ms.+]/\e[1;33;44m$&\e[0m/g'" do |channel, stream, data| | |
puts "#{data}" | |
break if stream == :err | |
end | |
end | |
# gem install request-log-analyzer | |
desc "Request-log-analyzer" | |
task :rla, :roles => :app do | |
run "request-log-analyzer #{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