Skip to content

Revise custom headers format in documentation - #152

Merged
donoghuc merged 7 commits into
logstash-plugins:mainfrom
mmahacek:patch-1
Nov 10, 2026
Merged

donoghuc merged 7 commits into
logstash-plugins:mainfrom
mmahacek:patch-1

Conversation

@mmahacek

Copy link
Copy Markdown
Contributor

Updated the format for custom headers in documentation as the previous example would cause a pipeline error and Logstash would fail to start.

@mmahacek

Copy link
Copy Markdown
Contributor Author

Fixes #158

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The documented headers example uses an unsupported array of hashes, and the type descriptions should identify the supported single-hash format.

1 open issue
What changed in this PR

This documentation-only PR revises the Logstash HTTP output plugin’s custom-header guidance to address reported pipeline startup failures.

Changes:

  • Changes the documented headers type from a hash to a list of hashes.
  • Replaces the custom-header example with an array containing two header hashes.
File Description
docs/​index.asciidoc Updates the headers type descriptions and configuration example.

Review effort: Balanced

Comment thread docs/index.asciidoc Resolved

@donoghuc donoghuc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

headers => Result
["X-My-Header", "%{host}"] (current docs) works
{ "X-My-Header" => "%{host}" } works
{ "X-A" => "1" "X-B" => "2" } works
{ "X-A" => "1", "X-B" => "2" } fails at startup (parse error, commas not allowed)
[{"X-My-Header" => "%{host}"}] fails at startup (must contain an even number of items)
[{"X-My-Header" => "%{host}"}, {"X-My-Header2" => "value"}] (this PR) starts, then drops every event

Could you share the config and error that made Logstash fail to start? I'd like to confirm it was one of the two startup failures above.

Suggestion: keep the type as hash and use the same format as other plugins (e.g. custom_headers in the elasticsearch output):

| <<plugins-{type}s-{plugin}-headers>> |<<hash,hash>>|No
===== `headers`

  * Value type is <<hash,hash>>
  * There is no default value for this setting.

Custom headers to send with each request, as a hash of `"Header-Name" => "value"` pairs.
Values support field references.

[source,ruby]
    headers => {
      "X-My-Header" => "%{[host][name]}"
      "X-Other"     => "static-value"
    }

Separate entries with spaces or newlines, not commas.

The same example should go in the comment at lib/logstash/outputs/http.rb:53.

mmahacek and others added 2 commits November 9, 2026 16:33
Correct the format for custom headers in documentation.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mmahacek

Copy link
Copy Markdown
Contributor Author

Unfortunately, I don't have the original config from when I raised this last year. I also did some testing, and matched your results. I pushed updates to update the documentation to match line 3 from your tests, showing multiple headers, and also updated the comment in http.rb.

Comment thread docs/index.asciidoc Resolved
Comment thread docs/index.asciidoc Resolved
Updated documentation for 'headers' to clarify value type and format.
Comment thread docs/index.asciidoc Resolved
Comment thread docs/index.asciidoc Resolved
@donoghuc
donoghuc merged commit 9c0b6fb into logstash-plugins:main Nov 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants