Skip to content

Instantly share code, notes, and snippets.

@basgys
Created May 11, 2012 14:21
Show Gist options
  • Save basgys/2659978 to your computer and use it in GitHub Desktop.
Save basgys/2659978 to your computer and use it in GitHub Desktop.
Rake task to tail multiple log files
desc "Tail logs"
task :logs => :environment do |t, args|
log_files = ['log/searchd.log', 'log/searchd.query.log', 'log/resque.log', 'log/development.log']
system "tail -f -n 2 #{log_files.map {|f| "#{Rails.root}/#{f}"}.join(' ')} | perl -pe 's/^(==>)(.*)(<==)$/\e[1;33;40m$&\e[0m/g'"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment