Class: Fluent::Plugin::MultilineCSVParser

Inherits:
CSVParser
  • Object
show all
Defined in:
lib/fluent/plugin/parser_multiline_csv.rb

Overview

This class can be used to parse CSV files that span multiple lines. Like the [multiline parser](docs.fluentd.org/parser/multiline), define a ‘format_firstline` for the `tail` input module to match against. Then use the [csv parser](docs.fluentd.org/parser/csv) parameters.

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/fluent/plugin/parser_multiline_csv.rb', line 17

def configure(conf)
  super

  if @format_firstline
    check_format_regexp(@format_firstline, 'format_firstline')
    @firstline_regex = Regexp.new(@format_firstline[1..-2])
  end
end

#firstline?(text) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fluent/plugin/parser_multiline_csv.rb', line 34

def firstline?(text)
  @firstline_regex.match(text)
end

#has_firstline?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/fluent/plugin/parser_multiline_csv.rb', line 28

def has_firstline?
  !!@format_firstline
end