Skip to content

Conversation

@martijnvg
Copy link
Member

Backports the following commits to 8.18:

…pdate `logsdb.prior_logs_usage` cluster setting (elastic#128050)

The following failure occurs when the LogsPatternUsageService updates the `logsb.prior_logs_usage` cluster setting:

```
[2025-05-13T17:11:21,685][DEBUG ][o.e.x.l.LogsPatternUsageService] [test-cluster-0] Failed to update [logsdb.prior_logs_usage] org.elasticsearch.ElasticsearchSecurityException: action [cluster:admin/settings/update] is unauthorized for user [_system] with effective roles [_system], this action is granted by the cluster privileges [manage,all]
	at [email protected]/org.elasticsearch.xpack.core.security.support.Exceptions.authorizationError(Exceptions.java:36)
	at [email protected]/org.elasticsearch.xpack.security.authz.AuthorizationService.denialException(AuthorizationService.java:1014)
	at [email protected]/org.elasticsearch.xpack.security.authz.AuthorizationService.actionDenied(AuthorizationService.java:991)
	at [email protected]/org.elasticsearch.xpack.security.authz.AuthorizationService.actionDenied(AuthorizationService.java:980)
	at [email protected]/org.elasticsearch.xpack.security.authz.AuthorizationService.actionDenied(AuthorizationService.java:970)
	at [email protected]/org.elasticsearch.xpack.security.authz.AuthorizationService.authorizeSystemUser(AuthorizationService.java:706)
	at [email protected]/org.elasticsearch.xpack.security.authz.AuthorizationService.authorize(AuthorizationService.java:320)
	at [email protected]/org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$applyInternal$5(SecurityActionFilter.java:178)
```

This results in the `logsdb.prior_logs_usage` cluster setting not being set and causes the LogsPatternUsageService to continuously attempt to update the mentioned setting every 1 minute. The result of this is that the mentioned setting is never set, which if a cluster upgrades to 9.x, causes logsdb to be enabled by default. Which shouldn't happen for clusters upgrading from 8.x with data streams in the `logs-*-*` namespace.

Unfortunately, this bug wasn't noticed given that the error wasn't visible (only if DEBUG logging was enabled) and the tests that test this functionality specifically don't run with security enabled.

The fix is to use OriginSettingClient client instead of node client directly, so that xpack internal user is used, which does have to privileges to update cluster settings.
@martijnvg martijnvg added :StorageEngine/Logs You know, for Logs >bug auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:StorageEngine labels May 14, 2025
@elasticsearchmachine elasticsearchmachine merged commit 3a864d5 into elastic:8.18 May 14, 2025
15 checks passed
@martijnvg martijnvg deleted the backport/8.18/pr-128050 branch May 14, 2025 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug :StorageEngine/Logs You know, for Logs Team:StorageEngine v8.18.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants