Module: TreasureData::FileReader::RegexpParserMixin

Included in:
ApacheParser, SyslogParser
Defined in:
lib/td/file_reader.rb

Overview

TODO: Support user defined format like in_tail

Instance Method Summary collapse

Instance Method Details

#forwardObject



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/td/file_reader.rb', line 140

def forward
  while true
    line = @reader.forward_row
    begin
      m = @regexp.match(line)
      unless m
        @error.call("invalid #{@format} format", line)
        next
      end

      return m.captures
    rescue
      @error.call("skipped: #{$!}", line)
      next
    end
  end
end

#initialize(reader, error, opts) ⇒ Object



135
136
137
138
# File 'lib/td/file_reader.rb', line 135

def initialize(reader, error, opts)
  @reader = reader
  @error = error
end