lib/syslogstash/syslog_reader.rb in syslogstash-0.3.0 vs lib/syslogstash/syslog_reader.rb in syslogstash-0.4.0

- old
+ new

@@ -5,12 +5,12 @@ class Syslogstash::SyslogReader include Syslogstash::Worker attr_reader :file - def initialize(file, tags, logstash) - @file, @tags, @logstash = file, tags, logstash + def initialize(file, tags, logstash, metrics) + @file, @tags, @logstash, @metrics = file, tags, logstash, metrics log { "initializing syslog socket #{file} with tags #{tags.inspect}" } end # Start reading from the socket file, parsing entries, and flinging @@ -35,9 +35,10 @@ @worker = Thread.new do begin loop do msg = socket.recvmsg debug { "Message received: #{msg.inspect}" } + @metrics.received(@file, Time.now) process_message msg.first.chomp end ensure socket.close log { "removing socket file #{@file}" }