diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/support/mapper/NativeRoleMappingStore.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/support/mapper/NativeRoleMappingStore.java index 18d9070d08a33..218e120e30941 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/support/mapper/NativeRoleMappingStore.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/support/mapper/NativeRoleMappingStore.java @@ -136,21 +136,17 @@ protected void loadMappings(ActionListener> listener ScrollHelper.fetchAllByEntity( client, request, - new ContextPreservingActionListener<>( - supplier, - ActionListener.wrap( - (Collection mappings) -> listener.onResponse( - mappings.stream().filter(Objects::nonNull).toList() - ), - ex -> { - logger.error( - () -> format("failed to load role mappings from index [%s] skipping all mappings.", SECURITY_MAIN_ALIAS), - ex - ); - listener.onResponse(Collections.emptyList()); - } - ) - ), + new ContextPreservingActionListener<>(supplier, ActionListener.wrap((Collection mappings) -> { + final List mappingList = mappings.stream().filter(Objects::nonNull).toList(); + logger.debug("successfully loaded [{}] role-mapping(s) from [{}]", mappingList.size(), securityIndex.aliasName()); + listener.onResponse(mappingList); + }, ex -> { + logger.error( + () -> format("failed to load role mappings from index [%s] skipping all mappings.", SECURITY_MAIN_ALIAS), + ex + ); + listener.onResponse(Collections.emptyList()); + })), doc -> buildMapping(getNameFromId(doc.getId()), doc.getSourceRef()) ); } @@ -202,6 +198,7 @@ private void modifyMapping( ); } else { try { + logger.trace("Modifying role mapping [{}] for [{}]", name, request.getClass().getSimpleName()); inner.accept(request, ActionListener.wrap(r -> refreshRealms(listener, r), listener::onFailure)); } catch (Exception e) { logger.error(() -> "failed to modify role-mapping [" + name + "]", e);