capistrano-logtail
Log tailing for capistrano
Installation
Add this line to your application's Gemfile:
gem 'capistrano-logtail'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-logtail
Configuration
set :logtail_files, %w( /var/log/syslog )
set :logtail_lines, 50
Usage
Require in Capfile
:
require 'capistrano/logtail'
This will add the following tasks:
- logs:tail[]
- logs:tail:all
- logs:tail:rails
Add tasks for other log files as required:
# config/deploy.rb
namespace :logs do
namespace :tail do
desc 'Tail sidekiq log'
task :sidekiq do
on roles(:app) do
logtail_utility.tail(release_path.join('log', 'sidekiq.log'))
end
end
end
end
# cap production logs:tail:sidekiq
Examples:
$ cap production logs:tail:all
$ cap production logs:tail:rails
$ cap production logs:tail[production] # tails shared/log/production.log
$ cap production logs:tail[/var/log/nginx/access.log]
$ cap production logs:tail # uses value of logtail_files
$ cap production logs:tail n=100 # specify number of existing lines to show
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request