ELK常用命令合集

ELK常用命令合集

   夏克东     2023年10月9日 09:38     928    

GET _cat/indices?s=store.size:desc  #索引按大小排序

GET brazil-prod_gwm-gateway-five-server_tsptrace_log_2023.10.08/_settings  #查看该索引详细,包括生命周期管理策略、创建时间等

POST _opendistro/_ism/remove/br*   #批量移除索引策略

POST _opendistro/_ism/add/brazil-prod_gwm-data-upload-gateway*

{

 "policy_id": "brazil-7d"

}

#批量增加索引策略

  1. PUT _cluster/settings

  2. {

  3.     "persistent": {

  4.         "action.auto_create_index": "twitter,index10,-index1*,+ind*"① 

  5.     }

  6. }

允许自动创建名为twitter或index10的索引,阻止创建与index1*模式匹配的索引,并允许创建与ind*模式匹配的任何其他索引。模式是按照指定的顺序匹配的。

  1. PUT _cluster/settings

  2. {

  3.     "persistent": {

  4.         "action.auto_create_index": "false" ②

  5.     }

  6. }

完全禁用自动创建索引。

  1. PUT _cluster/settings

  2. {

  3.     "persistent": {

  4.         "action.auto_create_index": "true" ③

  5.     }

  6. }

打开所有所有的自动创建

PUT _cluster/settings

{

"persistent": {

"action.auto_create_index": "null*"

}

}

##允许brazil-prod开头的索引创建

PUT _cluster/settings

{

"persistent": {

"action.auto_create_index": "+brazil-prod*"

}

}

==========================================

生命周期管理策略

{    "policy": {        "policy_id": "brazil-7d",        "description": "customPolicy hot warn read_only cold close delete policy.",        "last_updated_time": 1696813249516,        "schema_version": 1,        "error_notification": null,        "default_state": "hot",        "states": [            {                "name": "hot",                "actions": [],                "transitions": [                    {                        "state_name": "cold",                        "conditions": {                            "min_index_age": "2d"                        }                    }                ]            },            {                "name": "cold",                "actions": [                    {                        "read_only": {}                    }                ],                "transitions": [                    {                        "state_name": "delete",                        "conditions": {                            "min_index_age": "7d"                        }                    }                ]            },            {                "name": "delete",                "actions": [                    {                        "delete": {}                    }                ],                "transitions": []            }        ]    } }


文章评论

3

其他文章