Class: TreasureData::FileReader::SyslogParser

Inherits:
Object
  • Object
show all
Includes:
RegexpParserMixin
Defined in:
lib/td/file_reader.rb

Constant Summary collapse

COLUMNS =

This parser doesn’t consider nil value. But td platform removes the key, which has nil value, in data import. So this is not critical in table:import.

['time', 'host', 'ident', 'pid', 'message']
TIME_FORMAT =
"%b %d %H:%M:%S"

Instance Method Summary collapse

Methods included from RegexpParserMixin

#forward

Constructor Details

#initialize(reader, error, opts) ⇒ SyslogParser

Returns a new instance of SyslogParser.



187
188
189
190
191
192
193
# File 'lib/td/file_reader.rb', line 187

def initialize(reader, error, opts)
  super

  # e.g. Dec 20 12:41:44 localhost kernel:10000 [4843680.692840] e1000e: eth2 NIC Link is Down
  @format = 'syslog'
  @regexp = /^([^ ]* [^ ]* [^ ]*) ([^ ]*) ([a-zA-Z0-9_\/\.\-]*)(?:\[([0-9]+)\])?[^\:]*\: *(.*)$/
end