Skip to content

Silence logging of expected failures - #3760

Open
koetsier wants to merge 1 commit into
mainfrom
silence_fatal
Open

koetsier wants to merge 1 commit into
mainfrom
silence_fatal

Conversation

@koetsier

@koetsier koetsier commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

When indices.get_alias is called with an alias that doesn’t exist, OpenSearch logs the resulting 404 as FATAL.

Use a separate client with logging disabled for this expected failure, so it is handled without adding confusing errors to the application logs.

This issue generates logs when creating indices such as:

 INFO  Services : GET http://opensearch-3:9200/govuk/_alias [status:404, request:0.004s, query:N/A]
FATAL  Services : [404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [govuk]","index":"govuk","resource.id":"govuk","resource.type":"index_or_alias","index_uuid":"_na_"}],"type":"index_not_found_exception","reason":"no such index [govuk]","index":"govuk","resource.id":"govuk","resource.type":"index_or_alias","index_uuid":"_na_"},"status":404}
 INFO  Services : GET http://opensearch-3:9200/ [status:200, request:0.002s, query:n/a]
 INFO  Services : GET http://opensearch-3:9200/_alias/govuk [status:404, request:0.004s, query:N/A]
FATAL  Services : [404] {"error":"alias [govuk] missing","status":404}
 INFO  SearchIndices::IndexGroup : Switching govuk alias from [] to "govuk-2026-09-30t15-10-04z-1d7893c3-d037-4090-aa36-2007f6b91171"
 INFO  Services : POST http://opensearch-3:9200/_aliases [status:200, request:0.019s, query:n/a]
 INFO  Services : GET http://opensearch-3:9200/ [status:200, request:0.002s, query:n/a]
 INFO  Services : PUT http://opensearch-3:9200/page-traffic-2026-09-30t15-10-04z-4bf6ac07-1e5f-4a27-b54c-bec82c41e4c8 [status:200, request:0.092s, query:n/a]
 INFO  SearchIndices::IndexGroup : Created index page-traffic-2026-09-30t15-10-04z-4bf6ac07-1e5f-4a27-b54c-bec82c41e4c8
 INFO  Services : GET http://opensearch-3:9200/ [status:200, request:0.002s, query:n/a]
 INFO  Services : GET http://opensearch-3:9200/page-traffic/_alias [status:404, request:0.002s, query:N/A]
FATAL  Services : [404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [page-traffic]","index":"page-traffic","resource.id":"page-traffic","resource.type":"index_or_alias","index_uuid":"_na_"}],"type":"index_not_found_exception","reason":"no such index [page-traffic]","index":"page-traffic","resource.id":"page-traffic","resource.type":"index_or_alias","index_uuid":"_na_"},"status":404}

The FATAL messages are expected but can confuse and so are best silenced.

When indices.get_alias is called with an alias that doesn’t exist,
OpenSearch logs the resulting 404 as FATAL.

Use a separate client with logging disabled for this expected failure,
so it is handled without adding confusing errors to the application logs.

# Conflicts:
#	lib/index.rb
#	lib/index_group.rb
#	lib/services.rb

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant