Sha256: d068dfb18a5a5834788fc4b7cf8759e4c1999cfa9308c737bc8989fd41a04421

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'fluent/plugin/parser_grok'

module Fluent
  class TextParser
    class MultilineGrokParser < GrokParser
      Plugin.register_parser('multiline_grok', self)
      config_param :multiline_start_regexp, :string, :default => nil


      def initialize
        super
      end

      def configure(conf={})
        super
      end

      def has_firstline?
        !!@multiline_start_regexp
      end

      def firstline?(text)
        @multiline_start_regexp && !@multiline_start_regexp.match(text)
      end

      def parse(text, &block)
        if block_given?
          @grok.parsers.each do |parser|
            parser.parse(text) do |time, record|
              if time and record
                yield time, record
                return
              end
            end
          end
        else
          @grok.parsers.each do |parser|
            parser.parse(text) do |time, record|
              if time and record
                return time, record
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-grok-parser-0.0.3 lib/fluent/plugin/parser_multiline_grok.rb