paras200 commented on code in PR #986: URL: https://github.com/apache/ranger/pull/986#discussion_r3380112543
########## audit-server/audit-dispatcher/dispatcher-opensearch/src/main/java/org/apache/ranger/audit/dispatcher/OpenSearchDispatcherManager.java: ########## @@ -0,0 +1,208 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.ranger.audit.dispatcher; + +import org.apache.ranger.audit.dispatcher.kafka.AuditDispatcher; +import org.apache.ranger.audit.dispatcher.kafka.AuditDispatcherTracker; +import org.apache.ranger.audit.dispatcher.kafka.AuditOpenSearchDispatcher; +import org.apache.ranger.audit.provider.MiscUtil; +import org.apache.ranger.audit.server.AuditServerConstants; +import org.apache.ranger.audit.utils.AuditServerLogFormatter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Properties; + +public final class OpenSearchDispatcherManager { + private static final Logger LOG = LoggerFactory.getLogger(OpenSearchDispatcherManager.class); + private static final String CONFIG_DISPATCHER_TYPE = AuditServerConstants.PROP_DISPATCHER_TYPE; + private static final String TYPE_OPENSEARCH = "opensearch"; + private static final String ES_DEST_PROP = "xasecure.audit.destination.elasticsearch"; Review Comment: Done — renamed to `xasecure.audit.destination.opensearch`. The prior approach reused `xasecure.audit.destination.elasticsearch` for backward compatibility — since OpenSearch is wire-compatible with Elasticsearch, the initial thinking was to share a single namespace so operators familiar with the existing ES config wouldn't need to learn new property names. However, this conflated two independent systems: Ranger Admin's `ranger.audit.elasticsearch.*` properties (in `ranger-admin-site.xml`) are used for UI audit queries, while the dispatcher's `xasecure.audit.destination.*` properties (in `ranger-audit-dispatcher-opensearch-site.xml`) control dispatcher enablement. These two config namespaces don't interact, so reusing the ES name added confusion without any functional benefit. Clean separation is the right approach. Updated in both site XMLs (source + docker), the manager class, and tests. Verified end-to-end with the Docker stack — dispatcher starts, indexes audits, and health-checks pass. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
