feat(fluentd-plugin-datadog-loki): support custom http headers (#14299)

Co-authored-by: Trevor Whitney <trevorjwhitney@gmail.com>
pull/14290/head
Andrii Chubatiuk 2 years ago committed by GitHub
parent 720c303792
commit e59035e173
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      clients/cmd/fluentd/lib/fluent/plugin/out_loki.rb

@ -61,6 +61,9 @@ module Fluent
desc 'TLS: disable server certificate verification'
config_param :insecure_tls, :bool, default: false
desc 'Custom HTTP headers'
config_param :custom_headers, :hash, default: {}
desc 'Loki tenant id'
config_param :tenant, :string, default: nil
@ -232,6 +235,9 @@ module Fluent
req = Net::HTTP::Post.new(
@uri.request_uri
)
@custom_headers.each do |key, value|
req.add_field(key, value)
end
req.add_field('Content-Type', 'application/json')
req.add_field('Authorization', "Bearer #{@auth_token_bearer}") unless @auth_token_bearer.nil?
req.add_field('X-Scope-OrgID', tenant) if tenant

Loading…
Cancel
Save