elastic / elastic/logstash

Config test and environment variables don't work together

Open
#5,495 2 comments 6 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
19h 14m
Merged PRs (30d)
63

Description

It seems that `-t` parameter does not do type conversion as it should be done without `-t`.

Consider the following test input config:

```
input {
kafka {
zk_connect => "${ZK_HOST}"
topic_id => "test"
group_id => "test"
consumer_threads => "${CONSUMER_THREADS}"
queue_size => 2000
}
}
```

Logstash can be sucessfully started with:

```
ZK_HOST=localhost CONSUMER_THREADS=10 logstash --allow-env -f ./logstash.conf
```

But if executing with `-t` like:

```
ZK_HOST=localhost CONSUMER_THREADS=10 logstash -t --allow-env -f ./logstash.conf
```

It fails with:

```
Invalid setting for kafka input plugin:

input {
kafka {
# This setting must be a number
# Expected number, got "${CONSUMER_THREADS}" (type ${CONSUMER_THREADS})
consumer_threads => "${CONSUMER_THREADS}"
...
}
} {:level=>:error}
The given configuration is invalid. Reason: Something is wrong with your configuration. {:level=>:fatal}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.