/ Published in: Ruby
Digs through the exim log and gives a count for every email address that's generating SMTP errors
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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) }