elk清理日志
查询索引:
[root@master1 wj]# curl -XGET 'http://100.113.145.246:9200/_cat/indices/?v' health status index uuid pri rep docs.count docs.deleted store.size pri.store.size yellow open logstash-jaeger-span-2021-01-31 lv9zUrXPRc-IO5P5ku0bNw 5 1 733951 0 31.9mb 31.9mb yellow open logstash-jaeger-span-2021-03-17 yuRjcspGTwClKaLwX1KlbQ 5 1 742714 0 32.4mb 32.4mb yellow open logstash-jaeger-service-2020-07-16 Dn5pa-nDSqa5ZloLKc9ljA 5 1 77 11 88.3kb 88.3kb
删除索引:
curl -XDELETE 'http://100.113.145.246:9200/索引名字'
[root@master1 ~]# curl -XDELETE 'http://100.113.145.246:9200/ks-logstash-log-2021.05.14' {"acknowledged":true}
空间释放:
[root@host-172-21-210-8 k8s]# du -sh *|grep G 129G kubesphere-logging-system-data-elasticsearch-logging-data-0-pvc-8917994a-608b-491c-9966-dd11cdfc8979 1.2G kubesphere-monitoring-system-prometheus-k8s-system-db-prometheus-k8s-system-0-pvc-ce7414fd-d9f9-4571-b78e-5f479b41724d [root@host-172-21-210-8 k8s]# du -sh *|grep G 19G kubesphere-logging-system-data-elasticsearch-logging-data-0-pvc-8917994a-608b-491c-9966-dd11cdfc8979 1.2G kubesphere-monitoring-system-prometheus-k8s-system-db-prometheus-k8s-system-0-pvc-ce7414fd-d9f9-4571-b78e-5f479b41724d
批量删除索引:
[root@master1 ~]# for i in `curl -s -XGET 'http://100.113.145.246:9200/_cat/indices/?v' |awk '{print $3}'|grep 2020`;do curl -XDELETE "http://100.113.145.246:9200/$i";done {"acknowledged":true}
elk带密码:
有密码方式,带密码:
curl -XGET "http://172.21.210.49:9200/_cat/shards" -u 用户名:密码
curl -XDELETE http://172.21.210.49:9200/$index_name -u 用户名:密码
做一个决定,并不难,难的是付诸行动,并且坚持到底。