paras200 commented on code in PR #986: URL: https://github.com/apache/ranger/pull/986#discussion_r3389488962
########## 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: Adding to my earlier note — introducing `OpenSearchAuditDestination` would also unblock upgrading to latest OpenSearch server versions (currently 3.6.0). Today we're pinned to OpenSearch 1.3.19 because we reuse the Elasticsearch `RestClient` from `ranger-audit-dest-es` (which pulls ES client 7.17.x). OpenSearch 2.0+ removed type-based APIs that the ES HLRC depends on, so a direct server upgrade isn't possible without a client migration. The `OpenSearchAuditDestination` work would require introducing these new dependencies: - `org.opensearch.client:opensearch-java:3.1.0` — the official OpenSearch Java client (Apache 2.0, supports OpenSearch 1.x–3.x) - `org.opensearch.client:opensearch-rest-client:3.1.0` — low-level REST transport layer This replaces the current reliance on `org.elasticsearch.client:elasticsearch-rest-client:7.17.x` and `org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.x` for the OpenSearch path. This is a non-trivial effort — the `opensearch-java` client has a different API surface (builder-based, no type parameters), so it's not a drop-in replacement. It will need its own set of integration tests against OpenSearch 2.x/3.x. I'd suggest handling this as a separate JIRA/PR to keep the scope manageable. -- 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]
