kibana api 添加角色
时间: 2023-12-10 21:04:21 浏览: 70
要使用 Kibana API 添加角色,您需要进行以下步骤:
1. 准备一个包含角色定义的 JSON 文件。例如:
```
{
"indices": [
{
"names": [ "index1", "index2" ],
"privileges": [ "read", "write", "create_index" ],
"allow_restricted_indices": false
}
],
"applications": [
{
"application": "kibana-.kibana",
"privileges": [ "dashboard_all", "visualization_all" ],
"resources": [ "space:my-space" ]
}
]
}
```
2. 通过 Kibana API 创建角色。例如:
```
POST /api/security/role/my-role
{
"elasticsearch": {
"cluster": [ "monitor" ],
"indices": [
{
"names": [ "index1", "index2" ],
"privileges": [ "read", "write", "create_index" ],
"allow_restricted_indices": false
}
]
},
"kibana": [
{
"base": [ "read" ],
"feature": {
"dashboard": [ "read", "create", "edit", "delete" ],
"visualization": [ "read", "create", "edit", "delete" ]
}
}
]
}
```
这将创建一个名为 `my-role` 的角色,该角色具有 Elasticsearch 集群的 `monitor` 权限,并允许读取、写入和创建 `index1` 和 `index2` 索引,以及在 Kibana 中读取和编辑 `dashboard` 和 `visualization`。
请注意,您需要具有适当的权限才能使用 Kibana API 创建角色。
阅读全文