Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions clients/cmd/fluentd/lib/fluent/plugin/out_loki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class LogPostError < StandardError; end
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

Expand Down Expand Up @@ -232,6 +235,9 @@ def loki_http_request(body, tenant)
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
Expand Down
Loading