01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
if $lang = /^...$/WAND(X1, w1, ..., Xk, wk, θ) if Σi(Xi * wi) >= 0==> trueAND(X1, .., Xk) === WAND(X1, 1, ..., Xk, 1, k)OR(X1, .., Xk) === WAND(X1, 1, ..., Xk, 1, 1)--- /etc/syslog.conf.20050610 2005-06-10 16:32:14.049304200 +0900+++ /etc/syslog.conf 2005-06-10 16:42:47.708973288 +0900@@ -4,7 +4,7 @@ # Log anything (except mail) of level info or higher. # Don't log private authentication messages!-*.info;mail.none;authpriv.none /var/log/messages+*.info;mail.none;authpriv.none;cron.none /var/log/messages # The authpriv file has restricted access. authpriv.* /var/log/secure@@ -22,3 +22,6 @@ # Save boot messages also to boot.log local7.* /var/log/boot.log++# Save cron+cron.* /var/log/cron#!/usr/local/bin/ruby#require 'mailread'require 'date'class Mail def initialize(file) @header = Hash.new([]) open(file) do |f| lines = f.readlines while (not lines.empty?) do line = lines.shift break if line =~ /^$/ line << lines.shift while lines[0] =~ /^\s/ if line =~ /\A(\S+):\s*(.*)\Z/m @header[$1.downcase] << $2 end end end end def [](key) @header[key.downcase] endendif $0 == __FILE__ counter = {} ARGV.each do |dir| Dir.new(dir).entries.grep(/^\d+$/).sort{|a,b| a.to_i <=> b.to_i}.each do |f| path = dir + "/" + f #STDERR.puts path m = Mail.new(path) next if m["Received"].empty? or m["Received"].nil? or m["Received"][0].empty? date = nil while date.nil? begin date = DateTime.parse(m["Received"].shift) rescue break if m["Received"].empty? or m["Received"].nil? end end next if date.nil? counter[date.strftime("%Y-%m-%d")] ||= 0 counter[date.strftime("%Y-%m-%d")] += 1# puts "#{f}\t#{date}" end end puts counter.keys.sort.each do |d| puts "#{d}\t#{counter[d]}" endend