class MailRelayLog
Public Class Methods
new(from, to, msgid)
click to toggle source
# File lib/fluent/plugin/out_mailrelay.rb, line 154 def initialize(from, to, msgid) @relay = [] @status = :init @from = from @to = to @msgid = msgid @delay_sum = 0 end
Public Instance Methods
merge(mta, relay_to, stat, dsn, delay, arrived_at_mta)
click to toggle source
# File lib/fluent/plugin/out_mailrelay.rb, line 180 def merge(mta, relay_to, stat, dsn, delay, arrived_at_mta) @relay.push({ 'mta' => mta, 'relay_to' => relay_to, 'stat' => stat, 'dsn' => dsn, 'delay' => delay, 'arrived_at_mta' => arrived_at_mta }) dtime = Time.parse(delay) if stat =='sent' or stat == 'bounced' @delay_sum += (dtime.hour * 60 * 60) + (dtime.min * 60) + (dtime.sec) end end
record()
click to toggle source
# File lib/fluent/plugin/out_mailrelay.rb, line 163 def record return { 'from' => @from, 'to' => @to, 'msgid' => @msgid, 'delay_sec_sum' => @delay_sum, 'relay' => @relay.each {|relay| { 'relay' => relay['relay'], 'stat' => relay['stat'], 'dsn' => relay['dsn'], 'delay' => relay['delay'], } } } end