[RORDEV-1861] Failover mode and cluster health check added for remote audit clusters - #1222
Open
mateuszkp96 wants to merge 64 commits into
Open
[RORDEV-1861] Failover mode and cluster health check added for remote audit clusters#1222mateuszkp96 wants to merge 64 commits into
mateuszkp96 wants to merge 64 commits into
Conversation
mateuszkp96
marked this pull request as draft
March 15, 2026 14:01
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
mateuszkp96
marked this pull request as ready for review
March 24, 2026 06:50
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
coutoPL
force-pushed
the
develop
branch
7 times, most recently
from
April 3, 2026 08:40
5b58901 to
1eaf7e0
Compare
coutoPL
requested changes
Apr 17, 2026
This comment was marked as outdated.
This comment was marked as outdated.
coutoPL
requested changes
Jun 12, 2026
This comment was marked as outdated.
This comment was marked as outdated.
The two create methods that take a config and the output service creators are private now. The tests make an AuditSetup and call the public create method. Format the touched files.
The two create methods that take a config and the output service creators are private now. The tests make an AuditSetup and call the public create method. Format the touched files.
Boot tests used the IndexOrDataStream capability only. Add a test that boots with IndexOnly and asserts that the index output is created. Reuse MockedCapabilities in the boot tests.
The loops discarded the bound ES version and repeated one assertion seven times. The capability comes from the ES module now, so name the tests after the capability instead of the version.
No test had a multi-output list with every output disabled. It proves that Configured is never empty.
The wildcard import of AuditingTool already brings it into scope.
A catch-all hides a new case. With the cases listed, the compiler reports a non-exhaustive match, which fails the build.
A fresh default config could render the authority differently than the config the URL was parsed with.
The class does not rotate over the nodes. The ES RestClient it wraps knows all the hosts and picks one.
The data stream setup made a second client with the same hosts and the same credentials, used it once, then closed it. Share the client that submits the audit events. The audit output service closes it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is an addition to RORDEV-2190. It gives the remote audit cluster two things: a
failovermode, and a connectivity check at startup.Before this change, a remote audit cluster had only one mode:
round-robin. ROR sent audit events to all nodes in turn. If a node was down, the ESRestClientmarked it dead and kept it dead with a growing backoff. During that time ROR could drop audit events. ROR also accepted any cluster settings without a check. A typo in a node URL, or nodes from two different clusters, was only found later in the logs.Failover mode
In
failovermode ROR uses one client per node. It sends every audit event to the first node. It moves to the next node only when the current node fails.IOException, or a 502/503/504 response) opens the circuit of that node. ROR then tries the next node.1000 * 1.5^(failures-1)milliseconds, up to 30 minutes. This is the same upper limit as the ESRestClientuses.round-robinstays the default. It is unchanged.Connectivity check
When ROR creates an audit output for a remote cluster, it now sends
GET /to every configured node, in parallel, with three retries. The results decide the outcome:cluster_uuidTwo different clusters in one audit output is always an error. One audit output can write to one cluster only.
The new
ignore_es_connectivity_problemsflag lets you accept an unreachable cluster:The flag covers a connectivity problem only. It does not cover a wrong cluster. Note also that a
data_streamoutput must read or create the data stream when it starts, so that output still fails when no node answers.Tests
FailoverClientTests— 15 unit tests for the failover client: node selection, the two failure classes, circuit timing, the 30-minute limit, and the all-circuits-open case.ReadonlyRestStartingTests— startup with mixed clusters, with all nodes down, and withignore_es_connectivity_problemson. Three WireMock stubs give two nodes of one cluster and one node of another.AuditingConfigTests— decoding ofmode: failoverand ofignore_es_connectivity_problems.RemoteClusterAuditingToolsSuite— rewritten. It now tests both modes against Toxiproxy, and the settings reload with the nodes down. Each test forces a fresh engine, so no circuit state moves between tests.Scope
es*xmodules: the same four files in each — the failover client build-up, the retryable-response test, and theprotectedcreator methods.For the reviewer
IndexBasedAuditOutputServiceCreator.indexandDataStreamBasedAuditOutputServiceCreator.dataStreamare nowprotected. Callers usecreateIndexService/createDataStreamService, which run the check first. This makes it impossible to build an output that skips the check.mode: failoverandignore_es_connectivity_problems. The error message already points todocs.readonlyrest.com/elasticsearch/audit#custom-audit-cluster.Summary by CodeRabbit
New Features
Bug Fixes