Return to Snippet

Revision: 42074
at February 26, 2011 09:39 by beaknit


Initial Code
if ARGV[0] == nil then
  puts "SYNTAX:  smtp_errors.rb <logfile>"
  exit
end

log = ARGV[0]

offenders = Hash.new(0)

File.open(log,"r").each do |line|
  if line =~ /SMTP error/ then
    addy = line.split(/ /)[4]
    offenders[addy] += 1
  end
end

offenders.each_pair {|o,k|
  puts sprintf("%-50s %d", o, k)
}

Initial URL


Initial Description
Digs through the exim log and gives a count for every email address that's generating SMTP errors

Initial Title
Rollup Count of Events

Initial Tags
ruby

Initial Language
Ruby