-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Command Manager settings on opensearch.yml #213
Implement Command Manager settings on opensearch.yml #213
Conversation
Add logs to track settings values
Set Job index as constant inside main CommandManager plugin class
Replace constants usage with getters
Testing changing the configuration options:Test config:root@config-test:~# tail -13 /etc/wazuh-indexer/opensearch.yml
command_manager:
timeout: 30
job:
schedule: 1
page_size: 2
pit_keep_alive: 30
index.template: "index-template-scheduled-commands"
api:
prefix: "/_test_prefix"
endpoint: "/test_endpoint"
index:
name: ".test-index"
template: "index-template-commands" Writing commands works:root@config-test:~# curl -sku admin:admin https://localhost:9200/_plugins/_test_prefix/test_endpoint -H 'Content-Type: application/json' -d "$(cat command.json)"
{"_index":".test-index","_documents":[{"_id":"lRffZJQBm0txxyk-F3on"},{"_id":"lhffZJQBm0txxyk-F3on"},{"_id":"lxffZJQBm0txxyk-F3on"}],"result":"OK"} The new index is created and used:root@config-test:~# curl -sku admin:admin https://localhost:9200/_cat/indices/.test-index?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open .test-index 9KCAY4yeRI27gDEmsfnYmQ 1 1 6 3 57.7kb 57.7kb |
I was trying to test the integer variables when I noticed the CPU usage spiked. [2025-01-14T14:01:20,670][WARN ][c.w.c.j.SearchThread ] [node-1] Empty hits page, not getting searchAfter values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commands are not being indexed:
[2025-01-14T16:35:39,730][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [2] from host [127.0.0.1:9200]
[2025-01-14T16:35:39,733][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [LFR0ZZQB9G2sMpT7xx3U] to the bulk request
[2025-01-14T16:35:39,735][ERROR][c.w.c.i.CommandIndex ] [integTest-0] Error indexing commands with bulk due to Cannot invoke "java.util.Map.size()" because "source" is null
On my testing, I added this to the build.gradle
file of the command manager plugin.
testClusters.integTest {
setting "command_manager.index.name", "custom-index-name"
setting "command_manager.job.index.template", "pepe"
setting "command_manager.index.template", "wololo"
...
}
More importantly, during testing, I've noticed severe issues about the configuration being exposed.
- The index names cannot be changed for several reasons:
- Custom index names may not match the index pattern defined in their companion index template.
- For the commands stream index, this index is accessed by several external actors, as for now, the Management API, but more will come.
- The endpoint URL to receive commands cannot be changed, as it is accessed by several external actors, as for now, the Management API, but more will come (Content Manager).
On another note, the timeout
setting could use a longer but more comprehensive name, for example client.timeout
or opensearch.client.timeout
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
Update in #213 (comment)
I have detected a weird behavior when changing the job's search page size. It looks like in enters an infinite loop.
[2025-01-16T14:09:55,188][DEBUG][o.o.c.c.C.CoordinatorPublication] [integTest-0] publication ended successfully: Publication{term=1, version=10}
[2025-01-16T14:09:56,158][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [2] from host [127.0.0.1:9200]
[2025-01-16T14:09:56,159][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [83Y8b5QB45_abGJWFfI_] to the bulk request
[2025-01-16T14:09:56,159][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [9HY8b5QB45_abGJWFfI_] to the bulk request
[2025-01-16T14:09:56,160][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
[2025-01-16T14:09:57,214][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [3] from host [127.0.0.1:9200]
[2025-01-16T14:09:57,215][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [-XY8b5QB45_abGJWGfJe] to the bulk request
[2025-01-16T14:09:57,215][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [-nY8b5QB45_abGJWGfJe] to the bulk request
[2025-01-16T14:09:57,215][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
[2025-01-16T14:09:57,995][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [4] from host [127.0.0.1:9200]
[2025-01-16T14:09:57,996][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [_3Y8b5QB45_abGJWHPJs] to the bulk request
[2025-01-16T14:09:57,996][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [AHY8b5QB45_abGJWHPNs] to the bulk request
[2025-01-16T14:09:57,997][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
[2025-01-16T14:09:58,689][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [5] from host [127.0.0.1:9200]
[2025-01-16T14:09:58,690][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [BXY8b5QB45_abGJWH_Mi] to the bulk request
[2025-01-16T14:09:58,690][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [BnY8b5QB45_abGJWH_Mi] to the bulk request
[2025-01-16T14:09:58,690][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
[2025-01-16T14:09:59,609][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [6] from host [127.0.0.1:9200]
[2025-01-16T14:09:59,610][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [C3Y8b5QB45_abGJWIvO6] to the bulk request
[2025-01-16T14:09:59,610][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [DHY8b5QB45_abGJWIvO6] to the bulk request
[2025-01-16T14:09:59,610][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
[2025-01-16T14:10:00,406][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [7] from host [127.0.0.1:9200]
[2025-01-16T14:10:00,407][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [EXY8b5QB45_abGJWJfPX] to the bulk request
[2025-01-16T14:10:00,407][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [EnY8b5QB45_abGJWJfPX] to the bulk request
[2025-01-16T14:10:00,407][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
[2025-01-16T14:10:42,423][INFO ][c.w.c.j.SearchThread ] [integTest-0] Query returned 14 hits.
[2025-01-16T14:10:42,478][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,479][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,480][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,482][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,483][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,484][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,485][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,486][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,487][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,489][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,491][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,492][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,493][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,494][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,495][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,497][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,498][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,499][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,501][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,502][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,503][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,504][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,506][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,507][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,508][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,510][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,511][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,513][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,515][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,516][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
[2025-01-16T14:10:42,518][WARN ][c.w.c.j.SearchThread ] [integTest-0] Empty hits page, not getting searchAfter values
To reproduce, add a custom setting in build.gradle
. I used
setting 'command_manager.job.page_size', "1"
Then, send some commands to the API.
This does not happen when using the default value.
2025-01-16T14:06:44.290+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :run
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,666][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [1] from host [127.0.0.1:9200]
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,672][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [Q5A5b5QBzFOclsIFuc7G] to the bulk request
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,672][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [RJA5b5QBzFOclsIFuc7I] to the bulk request
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,678][INFO ][o.o.p.PluginsService ] [integTest-0] PluginService:onIndexModule index:[SndWjcxMRPSqwNy_Mv76iQ/13sOWSCjSgScRXx2Jq1-Kg]
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,691][INFO ][o.o.c.m.MetadataIndexTemplateService] [integTest-0] adding template [index-template-commands] for index patterns [.commands*]
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,692][DEBUG][o.o.c.c.Coordinator ] [integTest-0] initialized PublicationContext using class: class org.opensearch.cluster.coordination.PublicationTransportHandler$PublicationContext
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,692][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] sending cluster state over transport to node: integTest-0
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,693][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] received diff cluster state version [6] with uuid [VonHqC2YQDuNTXtqeYZ2ZQ], diff size [612]
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,724][DEBUG][o.o.c.c.C.CoordinatorPublication] [integTest-0] publication ended successfully: Publication{term=1, version=6}
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,724][INFO ][c.w.c.u.IndexTemplateUtils] [integTest-0] Index template [index-template-commands] created successfully
2025-01-16T14:07:21.730+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,729][INFO ][o.o.p.PluginsService ] [integTest-0] PluginService:onIndexModule index:[.commands/k-JC7dBjR3SiyPN5THY95Q]
2025-01-16T14:07:21.830+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,742][INFO ][o.o.c.m.MetadataCreateIndexService] [integTest-0] [.commands] creating index, cause [auto(bulk api)], templates [index-template-commands], shards [1]/[0]
2025-01-16T14:07:21.831+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,743][WARN ][o.o.c.r.a.AllocationService] [integTest-0] Falling back to single shard assignment since batch mode disable or multiple custom allocators set
2025-01-16T14:07:21.831+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,746][DEBUG][o.o.c.c.Coordinator ] [integTest-0] initialized PublicationContext using class: class org.opensearch.cluster.coordination.PublicationTransportHandler$PublicationContext
2025-01-16T14:07:21.831+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,747][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] sending cluster state over transport to node: integTest-0
2025-01-16T14:07:21.831+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,748][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] received diff cluster state version [7] with uuid [WzbB-T1_SPK9XQW35V_xVg], diff size [780]
2025-01-16T14:07:21.831+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,788][INFO ][o.o.p.PluginsService ] [integTest-0] PluginService:onIndexModule index:[.commands/k-JC7dBjR3SiyPN5THY95Q]
2025-01-16T14:07:21.831+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,814][DEBUG][o.o.c.c.C.CoordinatorPublication] [integTest-0] publication ended successfully: Publication{term=1, version=7}
2025-01-16T14:07:21.931+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,879][INFO ][o.o.c.r.a.AllocationService] [integTest-0] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.commands][0]]]).
2025-01-16T14:07:21.931+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,879][DEBUG][o.o.c.c.Coordinator ] [integTest-0] initialized PublicationContext using class: class org.opensearch.cluster.coordination.PublicationTransportHandler$PublicationContext
2025-01-16T14:07:21.931+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,880][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] sending cluster state over transport to node: integTest-0
2025-01-16T14:07:21.931+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,880][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] received diff cluster state version [8] with uuid [c5IeMq_-Riu_Rg-XjqhabQ], diff size [437]
2025-01-16T14:07:21.931+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,915][DEBUG][o.o.c.c.C.CoordinatorPublication] [integTest-0] publication ended successfully: Publication{term=1, version=8}
2025-01-16T14:07:21.931+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,916][WARN ][o.o.c.r.a.AllocationService] [integTest-0] Falling back to single shard assignment since batch mode disable or multiple custom allocators set
2025-01-16T14:07:21.931+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,930][INFO ][o.o.p.PluginsService ] [integTest-0] PluginService:onIndexModule index:[.commands/k-JC7dBjR3SiyPN5THY95Q]
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,939][INFO ][o.o.c.m.MetadataMappingService] [integTest-0] [.commands/k-JC7dBjR3SiyPN5THY95Q] update_mapping [_doc]
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,940][DEBUG][o.o.c.c.Coordinator ] [integTest-0] initialized PublicationContext using class: class org.opensearch.cluster.coordination.PublicationTransportHandler$PublicationContext
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,940][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] sending cluster state over transport to node: integTest-0
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,941][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] received diff cluster state version [9] with uuid [uJ5OYnsgT4mh9bQlJ1fJMw], diff size [764]
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,980][DEBUG][o.o.c.c.C.CoordinatorPublication] [integTest-0] publication ended successfully: Publication{term=1, version=9}
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:21,989][INFO ][o.o.p.PluginsService ] [integTest-0] PluginService:onIndexModule index:[.commands/k-JC7dBjR3SiyPN5THY95Q]
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,005][INFO ][o.o.c.m.MetadataMappingService] [integTest-0] [.commands/k-JC7dBjR3SiyPN5THY95Q] update_mapping [_doc]
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,007][DEBUG][o.o.c.c.Coordinator ] [integTest-0] initialized PublicationContext using class: class org.opensearch.cluster.coordination.PublicationTransportHandler$PublicationContext
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,007][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] sending cluster state over transport to node: integTest-0
2025-01-16T14:07:22.031+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,008][DEBUG][o.o.c.c.PublicationTransportHandler] [integTest-0] received diff cluster state version [10] with uuid [ToCzOhHSTwqXMszmIk1tTA], diff size [794]
2025-01-16T14:07:22.132+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,054][DEBUG][o.o.c.c.C.CoordinatorPublication] [integTest-0] publication ended successfully: Publication{term=1, version=10}
2025-01-16T14:07:22.732+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,674][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [2] from host [127.0.0.1:9200]
2025-01-16T14:07:22.732+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,675][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [SZA5b5QBzFOclsIFvc6z] to the bulk request
2025-01-16T14:07:22.732+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,675][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [SpA5b5QBzFOclsIFvc6z] to the bulk request
2025-01-16T14:07:22.732+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:22,676][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
2025-01-16T14:07:23.433+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:23,411][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [3] from host [127.0.0.1:9200]
2025-01-16T14:07:23.433+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:23,412][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [T5A5b5QBzFOclsIFwM6U] to the bulk request
2025-01-16T14:07:23.433+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:23,412][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [UJA5b5QBzFOclsIFwM6U] to the bulk request
2025-01-16T14:07:23.433+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:23,413][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
2025-01-16T14:07:24.034+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:24,010][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [4] from host [127.0.0.1:9200]
2025-01-16T14:07:24.034+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:24,011][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [VZA5b5QBzFOclsIFws7q] to the bulk request
2025-01-16T14:07:24.034+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:24,011][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [VpA5b5QBzFOclsIFws7q] to the bulk request
2025-01-16T14:07:24.034+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:24,011][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
2025-01-16T14:07:24.636+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:24,563][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [5] from host [127.0.0.1:9200]
2025-01-16T14:07:24.636+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:24,564][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [W5A5b5QBzFOclsIFxc4U] to the bulk request
2025-01-16T14:07:24.636+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:24,564][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [XJA5b5QBzFOclsIFxc4U] to the bulk request
2025-01-16T14:07:24.636+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:24,565][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
2025-01-16T14:07:25.236+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:25,178][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [6] from host [127.0.0.1:9200]
2025-01-16T14:07:25.237+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:25,179][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [YZA5b5QBzFOclsIFx857] to the bulk request
2025-01-16T14:07:25.237+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:25,179][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [YpA5b5QBzFOclsIFx857] to the bulk request
2025-01-16T14:07:25.237+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:25,179][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
2025-01-16T14:07:26.038+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:25,958][INFO ][c.w.c.r.RestPostCommandAction] [integTest-0] Received POST /_plugins/_command_manager/commands request id [7] from host [127.0.0.1:9200]
2025-01-16T14:07:26.038+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:25,959][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [Z5A5b5QBzFOclsIFys6H] to the bulk request
2025-01-16T14:07:26.038+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:25,959][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Adding command with id [aJA5b5QBzFOclsIFys6H] to the bulk request
2025-01-16T14:07:26.038+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:25,959][INFO ][c.w.c.i.CommandIndex ] [integTest-0] Index template index-template-commands already exists. Skipping creation.
2025-01-16T14:07:31.226+0100 [LIFECYCLE] [org.gradle.cache.internal.DefaultFileLockManager]
2025-01-16T14:07:31.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2025-01-16T14:07:31.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-16T14:07:31.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2025-01-16T14:07:31.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2025-01-16T14:07:31.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-16T14:07:31.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2025-01-16T14:07:37.506+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 4: acquired lock on worker lease
2025-01-16T14:07:37.506+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 4: released lock on worker lease
2025-01-16T14:07:37.506+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 7: acquired lock on worker lease
2025-01-16T14:07:37.506+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 7: released lock on worker lease
2025-01-16T14:07:37.506+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 6: acquired lock on worker lease
2025-01-16T14:07:37.506+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 6: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 11: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 11: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 12: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 12: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 13: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 13: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 14: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 14: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 4: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 4: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 10: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 10: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 9: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 9: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 8: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 8: released lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 15: acquired lock on worker lease
2025-01-16T14:07:37.507+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 15: released lock on worker lease
2025-01-16T14:07:37.508+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 2: acquired lock on worker lease
2025-01-16T14:07:37.508+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 2: released lock on worker lease
2025-01-16T14:07:37.508+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: acquired lock on worker lease
2025-01-16T14:07:37.508+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: released lock on worker lease
2025-01-16T14:07:37.508+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 3: acquired lock on worker lease
2025-01-16T14:07:37.508+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 3: released lock on worker lease
2025-01-16T14:07:37.508+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: acquired lock on worker lease
2025-01-16T14:07:37.508+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: released lock on worker lease
2025-01-16T14:07:41.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2025-01-16T14:07:41.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-16T14:07:41.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2025-01-16T14:07:41.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2025-01-16T14:07:41.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-16T14:07:41.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2025-01-16T14:07:25.989+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger]
2025-01-16T14:07:25.989+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :run
2025-01-16T14:07:44.259+0100 [LIFECYCLE] [org.opensearch.gradle.testclusters.RunTask] [2025-01-16T14:07:44,233][INFO ][c.w.c.j.SearchThread ] [integTest-0] Query returned 14 hits.
2025-01-16T14:07:51.226+0100 [LIFECYCLE] [org.gradle.cache.internal.DefaultFileLockManager]
2025-01-16T14:07:51.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2025-01-16T14:07:51.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-16T14:07:51.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2025-01-16T14:07:51.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2025-01-16T14:07:51.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-16T14:07:51.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2025-01-16T14:08:01.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2025-01-16T14:08:01.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-16T14:08:01.226+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2025-01-16T14:08:01.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2025-01-16T14:08:01.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2025-01-16T14:08:01.227+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
|
Using
However, if we set a negative value, the search job is never executed. |
Using
Using another positive value works as expected. However, during this test, I noticed that the query returns more results than the default page length (100).
|
Remove plugin-scurity.policy file as it is no longer needed
Looks like the CM's search thread enter an infinite loop whenever the number of commands is larger than the page size (pagination seems to be broken). In order to test this behavior, I indexed 120 commands through the CM's API. Default page length is 100, so I'm indexing more commands that what it can handle in a single page. As a result, the CM enters the infinite loop. I'm comparing this behavior on Update: I was able to reproduce it on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Set min and max values for settings and validate their coherence * Roll back to Setting.Property.NodeScope to fix issues * Make pit keepalive equal to job schedule in seconds * Make pit keepalive equal to job schedule in seconds * Fix tests * Refactor validateSettings() --------- Signed-off-by: Fede Galland <[email protected]> Co-authored-by: Alex Ruiz <[email protected]>
Signed-off-by: Álex Ruiz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
Implement PluginSettings class to load from the
opensearch.yml
file all the configuration used across the Command Manager plugin.Note
Configurations related to index/templates names and API URI were kept as constants rather than settings preventing runtime changes, which could lead to inconsistencies within plugin components and external interactions.
The resulting configuration YAML is structured as follows:
Proposed documentation
Command Manager Plugin Configuration
The Command Manager plugin allows you to configure various settings through the
opensearch.yml
file. Below is an overview of the available configuration options and their default values.Configuration Structure
The configuration settings for the Command Manager plugin are structured in the following hierarchy within the
opensearch.yml
file:Configuration Parameters
Timeout
command_manager.timeout
20
Job Schedule
command_manager.job.schedule
1
Job Page Size
command_manager.job.page_size
100
Job PIT Keep Alive
command_manager.job.pit_keep_alive
30
Job Index Template
command_manager.job.index.template
index-template-scheduled-commands
API Prefix
command_manager.api.prefix
/_command_manager
API Endpoint
command_manager.api.endpoint
/commands
Index Name
command_manager.index.name
.commands
Index Template
command_manager.index.template
index-template-commands
Notes
opensearch.yml
file.Issues Resolved
Closes #180