Sha256: 42c7e18dbdd36d4d90c9c0cb918c7ce6e7488e8da409b27f054ff7ee598574e2

Contents?: true

Size: 727 Bytes

Versions: 18

Compression:

Stored size: 727 Bytes

Contents

namespace :load do
  task :defaults do
    set :syslog_grep_pattern, ENV['pattern']
    set :syslog_all_logs, %w(y Y yes true 1).include?(ENV['all_logs'])
  end
end

namespace :syslog do
  desc <<-EOM
    Grep the syslog on all boxes for a specific pattern (cap production syslog:grep pattern=my_regex_pattern all_logs=y)
  EOM
  task :grep do
    syslogs_name =
      if fetch(:syslog_all_logs)
        '/var/log/syslog*'
      else
        '/var/log/syslog'
      end

    on release_roles :all do
      if fetch(:syslog_grep_pattern).to_s.strip != ''
        sudo 'zgrep', '-E', fetch(:syslog_grep_pattern), syslogs_name
      else
        fail 'No pattern specified, please use pattern=PATTERN'
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
elocal_capistrano-2.3.7 lib/tasks/syslog.rake
elocal_capistrano-2.3.6 lib/tasks/syslog.rake
elocal_capistrano-2.3.5 lib/tasks/syslog.rake
elocal_capistrano-2.3.4 lib/tasks/syslog.rake
elocal_capistrano-2.3.3 lib/tasks/syslog.rake
elocal_capistrano-2.3.2 lib/tasks/syslog.rake
elocal_capistrano-2.3.1 lib/tasks/syslog.rake
elocal_capistrano-2.3.0 lib/tasks/syslog.rake
elocal_capistrano-2.2.1 lib/tasks/syslog.rake
elocal_capistrano-2.2.0 lib/tasks/syslog.rake
elocal_capistrano-2.1.3 lib/tasks/syslog.rake
elocal_capistrano-2.1.2 lib/tasks/syslog.rake
elocal_capistrano-2.1.1 lib/tasks/syslog.rake
elocal_capistrano-2.0.4 lib/tasks/syslog.rake
elocal_capistrano-2.0.3 lib/tasks/syslog.rake
elocal_capistrano-2.0.2 lib/tasks/syslog.rake
elocal_capistrano-2.0.1 lib/tasks/syslog.rake
elocal_capistrano-2.0.0 lib/tasks/syslog.rake