设置一个cornjob,每天晚上1点删除10天之前的日志、
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: delteesdata
namespace: logging
spec:
schedule: "0 1 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: delete
image: centos:7
args:
- /bin/bash
- -c
- curl -XDELETE http://elasticsearch:9200/logstash-`date -d "10 days ago" +%Y.%m.%d`
restartPolicy: OnFailure