Skip to content

Commit

Permalink
Avoid long worrying log line at info level
Browse files Browse the repository at this point in the history
Currently there is an info level log line when checking if a datastream exists, but it includes the entire error even though it is caught and expected.

This results in long worrying looking log messages which are in fact not a problem (once you notice that they are info level) e.g. like this:
```
[info]: #0 Specified data stream does not exist. Will be created: <[404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [my.datastream.name]","resource.type":"index_or_alias","resource.id":"my.datastream.name","index_uuid":"_na_","index":"my.datastream.name"}],"type":"index_not_found_exception","reason":"no such index [my.datastream.name]","resource.type":"index_or_alias","resource.id":"my.datastream.name","index_uuid":"_na_","index":"my.datastream.name"},"status":404}>
```
so simplify it to instead just log the name of the datastream.

We know what the error is going to be given it is being caught explicitly.
  • Loading branch information
sparrowt authored Jan 5, 2024
1 parent 14f5eed commit 9aa8ae1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fluent/plugin/out_elasticsearch_data_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def data_stream_exist?(datastream_name, host = nil)
response = client(host).indices.get_data_stream(params)
return (not response.is_a?(TRANSPORT_CLASS::Transport::Errors::NotFound))
rescue TRANSPORT_CLASS::Transport::Errors::NotFound => e
log.info "Specified data stream does not exist. Will be created: <#{e}>"
log.info "Specified data stream does not exist. Will be created: <#{datastream_name}>"
return false
end
end
Expand Down

0 comments on commit 9aa8ae1

Please sign in to comment.