elastic / elastic/logstash

Inconsistency when passing by configuration options to Logstash

Open
#5,120 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
1d 4h
Merged PRs (30d)
88

Description

When having a configuration option like:

`config :host, :validate => :string, :default => "127.0.0.1:6379"`

use would expect to be validated as string, and if you used any other data type, LS should raise an error, but now if you pass something like:

```
{
'key' => 'foo',
"host" => [ "127.0.0.1:8080" ],
'data_type' => data_type,
}
```

then LS is just coercing this as string and allowing this configuration goes as good, even if this is actually an array.

having:

```
{
'key' => 'foo',
"host" => [ "127.0.0.1:8080" , "128.0.0.1:8081" ],
'data_type' => data_type,
}
```

will actually does the right thing and raise an issue.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two configuration examples using the `host` option with `validate => :string`, then trace the Logstash configuration validation and coercion entry points. Done means a single-element array is rejected consistently instead of being coerced to a string, while valid strings continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.