public
Description: A Rails log analyzer.
Homepage:
Clone URL: git://github.com/terrbear/logpwnr.git
logpwnr / logcopy.rb
100644 12 lines (9 sloc) 0.39 kb
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/local/bin/ruby
 
require 'date'
 
logdir = "/var/www/apps/#{ARGV[0]}/shared/log"
start_date = Date.parse(ARGV[1]) rescue Date.today
date_regex = (start_date .. Date.today).collect{|x| x.to_s}.join('|')
regex = /production.log.#{date_regex}/
Dir.new(logdir).entries.each do |entry|
puts "#{logdir}/#{entry}" if (entry =~ regex || entry =~ /production.log$/) && !(entry =~ (/brb/))
end