Kibana的一些api随记:修订间差异

来自三线的随记
(创建页面,内容为“=== space / 工作区 === official doc: https://www.elastic.co/guide/en/kibana/current/spaces-api.html 通过kibana space可以完成如隐藏index_pattern (索引…”)
 
无编辑摘要
 
(未显示同一用户的4个中间版本)
第12行: 第12行:


==== Create space API / 创建space ====
==== Create space API / 创建space ====
curl "<nowiki>http://kibana_url/api/spaces/space</nowiki>" -u root:root -H "kbn-version: 7.12.1" -XPOST -H "Content-Type: application/json" -d '{"id":"space-id","name":"space-name","description":"","initials":"","disabledFeatures":["siem","logs","infrastructure","apm","uptime","enterpriseSearch","advancedSettings","savedObjectsManagement","savedObjectsTagging","fleet","actions","stackAlerts","monitoring"]}'
<pre><nowiki>curl "http://kibana_url/api/spaces/space" -u root:root -H "kbn-version: 7.12.1" -XPOST -H "Content-Type: application/json" -d '{"id":"space-id","name":"space-name","description":"","initials":"","disabledFeatures":["siem","logs","infrastructure","apm","uptime","enterpriseSearch","advancedSettings","savedObjectsManagement","savedObjectsTagging","fleet","actions","stackAlerts","monitoring"]}'</nowiki></pre>
 
<pre><nowiki>space_info=space_name curl "http://kibana_url/api/spaces/space" -u root:root -H "kbn-version: 7.12.1" -XPOST -H "Content-Type: application/json" \
space_info=space_name curl "<nowiki>http://kibana_url/api/spaces/space</nowiki>" -u root:root -H "kbn-version: 7.12.1" -XPOST -H "Content-Type: application/json" -d '{"id":"${space_info}","name":"${space_info}","description":"","initials":"","disabledFeatures":["siem","logs","infrastructure","apm","uptime","enterpriseSearch","advancedSettings","savedObjectsManagement","savedObjectsTagging","fleet","actions","stackAlerts","monitoring"]}'
--data-binary @- << EOF
{
  "id": "${space_info}",
  "name": "${space_info}",
  "description": "${space_info}",
  "initials": "",
  "disabledFeatures": [
    "siem",
    "logs",
    "infrastructure",
    "apm",
    "uptime",
    "enterpriseSearch",
    "advancedSettings",
    "savedObjectsManagement",
    "savedObjectsTagging",
    "fleet",
    "actions",
    "stackAlerts",
    "monitoring"
  ]
}
EOF
</nowiki></pre>Related: [[一键创建kibana工作区(space)和对应只读角色的脚本]]
[[分类:Kibana]]
[[分类:Kibana]]
[[分类:Efk]]
[[分类:Efk]]

2023年1月11日 (三) 01:07的最新版本

space / 工作区

official doc: https://www.elastic.co/guide/en/kibana/current/spaces-api.html

通过kibana space可以完成如隐藏index_pattern (索引模式),针对space隐藏特定字段(但是还是能搜索),隐藏菜单 等定制化操作

在通过界面创建space检查无误后,可以通过kibana api批量创建space

Get all Kibana spaces API / 查询所有space

curl "http://kibana_url/api/spaces/space" -u root:root
curl "http://kibana_url/api/spaces/space" -u root:root -s | jq .

Create space API / 创建space

curl "http://kibana_url/api/spaces/space" -u root:root -H "kbn-version: 7.12.1" -XPOST -H "Content-Type: application/json" -d '{"id":"space-id","name":"space-name","description":"","initials":"","disabledFeatures":["siem","logs","infrastructure","apm","uptime","enterpriseSearch","advancedSettings","savedObjectsManagement","savedObjectsTagging","fleet","actions","stackAlerts","monitoring"]}'
space_info=space_name curl "http://kibana_url/api/spaces/space" -u root:root -H "kbn-version: 7.12.1" -XPOST -H "Content-Type: application/json" \
--data-binary @- << EOF
{
  "id": "${space_info}",
  "name": "${space_info}",
  "description": "${space_info}",
  "initials": "",
  "disabledFeatures": [
    "siem",
    "logs",
    "infrastructure",
    "apm",
    "uptime",
    "enterpriseSearch",
    "advancedSettings",
    "savedObjectsManagement",
    "savedObjectsTagging",
    "fleet",
    "actions",
    "stackAlerts",
    "monitoring"
  ]
}
EOF

Related: 一键创建kibana工作区(space)和对应只读角色的脚本