Default value for sprintf interpolation (Feature)
Open
enhancement
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 63
Description
In a lot places, Logstash allows to reference fields with the _sprintf format_(https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#sprintf). Unfortunately if the referenced field does not exist, _sprintf_ defaults to leave the the reference untouched, which may lead to very unsatisfactory results. Therefore I suggest to allow a default value for the sprintf interpolation, e.g.
```
output {
file {
path => "/var/log/%{type:-default}.%{+yyyy.MM.dd.HH}"
}
}
```
As delimiter between the field reference and the default value I suggest `:-` (taken from bash, unlikely to exist in a Logstash event field name).
Contributor guide
Assessment
This issue has not been assessed yet.