Rest anonymous access denied t uri= request body= – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-6.8

Briefly, this error occurs when an anonymous user tries to access Elasticsearch REST API without the necessary permissions. This could be due to incorrect configuration settings or lack of authentication. To resolve this issue, you can: 1) Enable anonymous access in Elasticsearch’s configuration file, but this may pose security risks. 2) Provide the necessary credentials when making the API request. 3) Configure user roles and permissions correctly in Elasticsearch’s security settings. Always ensure to follow best security practices when dealing with user access and permissions.

This guide will help you check for common problems that cause the log ” {}[rest] [anonymous_access_denied]t{}; uri=[{}]{}; request_body=[{}] ” 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=[{}]{}; request_body=[{}]” classname is DeprecatedLoggingAuditTrail.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

     
Override
    public void anonymousAccessDenied(String requestId; RestRequest request) {
        if (events.contains(ANONYMOUS_ACCESS_DENIED)
                && (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());
            }



 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?