[Rails] how to tail log from multiple servers

A different approach from the one described here: http://serverfault.com/questions/112457/tail-multiple-remote-files
is to use a capistrano task like (in my deploy.rb ) ,

task :tail_logs, :roles => :your_server_tag do

cap production deploy:tail_logs
run "tail -f #{current_path}/log/production.log" do |channel, stream, data|
puts # for an extra line break before the host name
puts "#{channel[:host]}: #{data}"
break if stream == :err
end
end

Nessun commento: