Sha256: 7e4545573edfa6969d4c1873c246e47e56d5ade9689b1601b78d3eab20ea9b70

Contents?: true

Size: 836 Bytes

Versions: 2

Compression:

Stored size: 836 Bytes

Contents

require 'fluent/plugin/in_syslog'
require 'fluent/plugin/in_http'
require_relative 'parser_logplex'

module Fluent
  module Plugin
    class HerokuHttpInput < HttpInput
      Fluent::Plugin.register_input('heroku_http', self)

      config_param :drain_ids, :array, default: nil

      config_section :parse do
        config_set_default :@type, 'logplex'
      end

      def parse_params_with_parser(params)
        drain_id = params['HTTP_LOGPLEX_DRAIN_TOKEN']

        if @drain_ids.nil? || @drain_ids.include?(drain_id)
          _time, records = super

          records.each do |record|
            record['drain_id'] = drain_id
          end

          [_time, records]
        else
          log.warn("drain_id #{drain_id.inspect} is not in #{@drain_ids.inspect}.")

          [nil, []]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-heroku-http-0.0.2 lib/fluent/plugin/in_heroku_http.rb
fluent-plugin-heroku-http-0.0.1 lib/fluent/plugin/in_heroku_http.rb