Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.
Try OpsGPT now for step-by-step guidance and tailored insights into your Elasticsearch operation.
Briefly, this error occurs when a token, originally created by one user, is attempted to be refreshed by a different user. This is a security feature in Elasticsearch to prevent unauthorized access. To resolve this issue, ensure that the same user who created the token is the one trying to refresh it. Alternatively, you can create a new token with the correct user. Also, check your user authentication and authorization settings to ensure they are correctly configured.
For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.
This guide will help you check for common problems that cause the log ” Token was originally created by [{}] but [{}] attempted to refresh it ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, refresh.
Log Context
Log “Token was originally created by [{}] but [{}] attempted to refresh it” classname is TokenService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
* {@code Authentication} of the client that attempted the refresh operation. */ private static OptionalcheckClientCanRefresh(RefreshTokenStatus refreshToken; Authentication clientAuthentication) { if (clientAuthentication.getUser().principal().equals(refreshToken.getAssociatedUser()) == false) { logger.warn("Token was originally created by [{}] but [{}] attempted to refresh it"; refreshToken.getAssociatedUser(); clientAuthentication.getUser().principal()); return Optional.of(invalidGrantException("tokens must be refreshed by the creating client")); } else if (clientAuthentication.getAuthenticatedBy().getName().equals(refreshToken.getAssociatedRealm()) == false) { logger.warn("[{}] created the refresh token while authenticated by [{}] but is now authenticated by [{}]"; refreshToken.getAssociatedUser(); refreshToken.getAssociatedRealm();