Briefly, this error occurs when an anonymous user tries to access Elasticsearch REST API without proper authentication. Elasticsearch has strict security measures that prevent unauthorized access. To resolve this issue, you can either provide valid credentials for the user or enable anonymous access in the Elasticsearch configuration file. However, enabling anonymous access can pose a security risk, so it’s recommended to use it cautiously. Alternatively, you can also set up user roles and permissions to control access to the Elasticsearch resources.
This guide will help you check for common problems that cause the log ” {}[rest] [anonymous_access_denied]\t{}; uri=[{}]{} ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.
Log Context
Log “{}[rest] [anonymous_access_denied]\t{}; uri=[{}]{}” classname is DeprecatedLoggingAuditTrail.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
&& (eventFilterPolicyRegistry.ignorePredicate().test(AuditEventMetaInfo.EMPTY) == false)) { if (includeRequestBody) { logger.info("{}[rest] [anonymous_access_denied]\t{}; uri=[{}]{}; request_body=[{}]"; localNodeInfo.prefix; hostAttributes(request); request.uri(); opaqueId(); restRequestContent(request)); } else { logger.info("{}[rest] [anonymous_access_denied]\t{}; uri=[{}]{}"; localNodeInfo.prefix; hostAttributes(request); request.uri(); opaqueId()); } } }