-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ElasticsearchClient should allow plugins to opt out of error logging #84447
Comments
Pinging @elastic/kibana-core (Team:Core) |
@elastic/kibana-core @pgayvallet Since any error will always bubble up to some error handler I wonder if we shouldn't log these errors as When an exception returned from a route handler is an |
This was kinda migrated as it was from the legacy client. However I agree that we would ideally add a way to opt-out from this automatic error logging. Main challenge here is that we are technically always creating clients via the kibana/src/core/server/elasticsearch/client/cluster_client.ts Lines 82 to 84 in 1ad68fd
and that the logging mechanism is done at the root/parent client level, and we don't have any information on the actual child emitting the kibana/src/core/server/elasticsearch/client/configure_client.ts Lines 27 to 34 in 274d5de
So maybe the proposed solution to lower the log level is the most pragmatic one.
The argument that the errors is going to be catched by some handler anyway makes sense. Maybe we could (in addition) also only log them when
We kinda were hoping to be able to remove the ES 401 error special handling in the routing layer at some point, so this would not really go in the right direction. What do you think about that @restrry? |
Yeah I like that idea.
Yeah this does mix up the two domains and encourages plugins to just throw Errors instead of catching it in their route handler and logging a human readable error there. Preferably such an error would then be linked to the plugin's domain like |
Yea, I'd say that letting the consumers 'fully' handle how they decide to log / handle the error is probably the way to go (if that's acceptable, I don't think changing that now would be considered a breaking change?). We could also expose a helper to properly format ES errors when logging them. |
I assumed so, but when I started working on #73672 I found out that it's not true.
I'm going to adjust the new ES client logging to be compatible with the legacy one. |
Whenever Elasticsearch responds with an error, the ElasticsearchClient automatically logs an
error
-level log message. However there are a lot of domains where an error response from Elasticsearch is an expected and valid response and not an error condition.kibana/src/core/server/elasticsearch/client/configure_client.ts
Lines 39 to 60 in 274d5de
Saved Object migrations
The migration algorithm introduced in v6.5 attempts to create an index which leads to a
index_already_exists_exception
which is an expected error meaning another Kibana instance already acquired the lock. The new migration algorithm slated for v7.11 ensures that all steps in the migration are idempotent meaning a successful migration can have several exceptions likeindex_already_exists_exception
,version_conflict_engine_exception
orindex_not_found_exception
all of which can safely be ignored. If the logs are filled with manyerror
-level messages users would not be confident that their data was safely upgraded.For example:
Task manager ensureScheduled
https://github.com/elastic/kibana/blob/master/x-pack/plugins/task_manager/server/task_scheduling.ts#L95-L113
Many plugins use task manager's
ensureScheduled
at startup to ensure that a usage collection task was registered for their plugin. The task manager will then use the saved objects repository to create this task using the Elasticsearchindex
API. Because an index operation fails with aversion_conflict_engine_exception
when an object already exists there are several entries in the Kibana startup logs like:These "error" messages confuse users who rightly think this is something that needs to be investigated. However, this is completely expected behaviour and the task manager already catches and ignores these errors.
The text was updated successfully, but these errors were encountered: