Repository navigation
Revise custom headers format in documentation - #152
Conversation
Updated the format for custom headers in documentation.
|
Fixes #158 |
There was a problem hiding this comment.
🟡 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
headerstype 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
donoghuc
left a comment
There was a problem hiding this comment.
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.
Correct the format for custom headers in documentation. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
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 |
Updated documentation for 'headers' to clarify value type and format.

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