Hi @qd-danh
Hmmmm I get the expected results
POST /_security/api_key
{
"name": "logs-reader-api-key",
"role_descriptors": {
"logs_reader_role": {
"cluster": [],
"indices": [
{
"names": ["logs-*"],
"privileges": ["read", "view_index_metadata"]
}
]
}
}
}
# Don't Worry not valid values :)
{
"id": "mwFEdfgdfgKolCVLzxclb-",
"name": "logs-reader-api-key",
"api_key": "SXovvEdfgdfgdZT-IJWpLAlOA",
"encoded": "bXdGRUU1cdhvdnZFZjg4YlpULdfhgdfghUlKV3BfgdffgdfgMQWxPQQ=="
}
Then Check Key
GET _security/api_key/?id=mwFEE5sBKolCVLzxclb-&with_limited_by=true
{
"api_keys": [
{
"id": "mwFEE5sBKolCVLzxclb-",
"name": "logs-reader-api-key",
"type": "rest",
"creation": 1765554811648,
"invalidated": false,
"username": "4212746406",
"realm": "cloud-saml-kibana",
"realm_type": "saml",
"metadata": {},
"role_descriptors": {
"logs_reader_role": {
"cluster": [],
"indices": [
{
"names": [
"logs-*"
],
"privileges": [
"read",
"view_index_metadata"
],
"allow_restricted_indices": false
}
],
"applications": [],
"run_as": [],
"metadata": {},
"transient_metadata": {
"enabled": true
}
}
},
"limited_by": [
{
"superuser": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"*"
],
"privileges": [
"all"
],
"allow_restricted_indices": false
},
{
"names": [
"*"
],
"privileges": [
"monitor",
"read",
"view_index_metadata",
"read_cross_cluster"
],
"allow_restricted_indices": true
}
],
"applications": [
{
"application": "*",
"privileges": [
"*"
],
"resources": [
"*"
]
}
],
"run_as": [
"*"
],
"metadata": {
"_reserved": true
},
"transient_metadata": {
"enabled": true
},
"remote_indices": [
{
"names": [
"*"
],
"privileges": [
"all"
],
"allow_restricted_indices": false,
"clusters": [
"*"
]
},
{
"names": [
"*"
],
"privileges": [
"monitor",
"read",
"view_index_metadata",
"read_cross_cluster"
],
"allow_restricted_indices": true,
"clusters": [
"*"
]
}
],
"remote_cluster": [
{
"privileges": [
"monitor_enrich",
"monitor_stats"
],
"clusters": [
"*"
]
}
]
}
}
]
}
]
}
Looks Good
Then Try Key
GET / Does Not Work as expected : 403
curl -S -H "Authorization: ApiKey $API_KEY" -X GET "https://somerandomecluster.es.us-west1.gcp.cloud.es.io" | jq
{
"error": {
"root_cause": [
{
"type": "security_exception",
"reason": "action [cluster:monitor/main] is unauthorized for API key id [mwFEE5sBKolCVLzxclb-] of user [4212746406], this action is granted by the cluster privileges [monitor,manage,all]"
}
],
"type": "security_exception",
"reason": "action [cluster:monitor/main] is unauthorized for API key id [mwFEE5sBKolCVLzxclb-] of user [4212746406], this action is granted by the cluster privileges [monitor,manage,all]"
},
"status": 403
}
Then try the search on the logs works
curl -S -H "Authorization: ApiKey $API_KEY" -X GET "https://somerandomecluster.es.us-west1.gcp.cloud.es.io/logs-*/_search?size=1" | jq
{
"took": 83,
"timed_out": false,
"_shards": {
"total": 176,
"successful": 176,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 10000,
"relation": "gte"
},
"max_score": 1.0,
"hits": [
{
"_index": ".ds-logs-azure.eventhub-default-2025.11.30-000020",
"_id": "90I275oBKolCVLzx4ypk",
"_score": 1.0,
"_source": {
"cloud": {
"availability_zone": "",
"instance": {
"name": "stephenb-logginig-test",
"id": "2fce0248-0dbf-4e17-9750-911c9ebaa3fa"
},
"provider": "azure",
"machine": {
"type": "Standard_D2ads_v5"
},
"service": {
"name": "Virtual Machines"
},
"region": "westus",
"account": {
"id": "ef3a5cc0-6972-4eac-94b7-e76a54c6aee8"
}
},
"input": {
"type": "azure-eventhub"
},
"agent": {
"name": "stephenb-logginig-test",
"id": "9eaf0e8f-a570-401b-8b63-0e4adb8e70ce",
"ephemeral_id": "6d9427ff-267e-471a-b0de-e9f519d8d2ee",
"type": "filebeat",
"version": "8.19.5"
},
"@timestamp": "2025-12-05T15:52:13.081Z",
"ecs": {
"version": "8.11.0"
},
....
}
So I am not seeing what your are seeing...
So perhaps you have something else going on. Somehow you're not using the API key you think you are, but I think I pretty much duplicated what you did and it seems to be honoring the privileges