{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/logstash/issues/4416","labels_url":"https://api.github.com/repos/elastic/logstash/issues/4416/labels{/name}","comments_url":"https://api.github.com/repos/elastic/logstash/issues/4416/comments","events_url":"https://api.github.com/repos/elastic/logstash/issues/4416/events","html_url":"https://github.com/elastic/logstash/issues/4416","id":124939593,"number":4416,"title":"Default value for sprintf interpolation (Feature)","user":{"login":"breml","id":6205217,"avatar_url":"https://avatars.githubusercontent.com/u/6205217?v=3","gravatar_id":"","url":"https://api.github.com/users/breml","html_url":"https://github.com/breml","followers_url":"https://api.github.com/users/breml/followers","following_url":"https://api.github.com/users/breml/following{/other_user}","gists_url":"https://api.github.com/users/breml/gists{/gist_id}","starred_url":"https://api.github.com/users/breml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breml/subscriptions","organizations_url":"https://api.github.com/users/breml/orgs","repos_url":"https://api.github.com/users/breml/repos","events_url":"https://api.github.com/users/breml/events{/privacy}","received_events_url":"https://api.github.com/users/breml/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/logstash/labels/enhancement","name":"enhancement","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-01-05T10:39:53Z","updated_at":"2016-01-07T07:03:22Z","closed_at":null,"body":"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.\r\n\r\n    output {\r\n      file {\r\n        path => \"/var/log/%{type:-default}.%{+yyyy.MM.dd.HH}\"\r\n      }\r\n    }\r\n\r\nAs delimiter between the field reference and the default value I suggest `:-` (taken from bash, unlikely to exist in a Logstash event field name)."},"comment":{"url":"https://api.github.com/repos/elastic/logstash/issues/comments/169576206","html_url":"https://github.com/elastic/logstash/issues/4416#issuecomment-169576206","issue_url":"https://api.github.com/repos/elastic/logstash/issues/4416","id":169576206,"user":{"login":"breml","id":6205217,"avatar_url":"https://avatars.githubusercontent.com/u/6205217?v=3","gravatar_id":"","url":"https://api.github.com/users/breml","html_url":"https://github.com/breml","followers_url":"https://api.github.com/users/breml/followers","following_url":"https://api.github.com/users/breml/following{/other_user}","gists_url":"https://api.github.com/users/breml/gists{/gist_id}","starred_url":"https://api.github.com/users/breml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breml/subscriptions","organizations_url":"https://api.github.com/users/breml/orgs","repos_url":"https://api.github.com/users/breml/repos","events_url":"https://api.github.com/users/breml/events{/privacy}","received_events_url":"https://api.github.com/users/breml/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T07:03:22Z","updated_at":"2016-01-07T07:03:22Z","body":"@jordansissel: Thanks for the workaround, we will try this one. Up until now we used the blacklist_values feature of https://github.com/logstash-plugins/logstash-filter-prune to remove fields with `%{...}` content. But the above workaround is sure the better and cleaner solution."}}