Hello Isman/Alex,
How about the script for opendj logs cleanup.
```
apiVersion: batch/v1
kind: CronJob
metadata:
name: opendj-log-cleanup-cronjob
namespace: mysso-sit
spec:
schedule: "0 1 * * *" # Run daily at 1 AM
jobTemplate:
spec:
template:
spec:
containers:
- name: log-cleanup
image: bitnami/kubectl:latest
command:
- /bin/sh
- -c
- |
POD_NAME=$(kubectl get pod -l app=opendj -n mysso-sit -o jsonpath='{.items[0].metadata.name}')
echo "Cleaning up OpenDJ logs older than 15 days..."
# Clean rotated logs like access.YYYYMMDD*, audit.YYYYMMDD*, etc.
kubectl exec -n mysso-sit $POD_NAME -- find /opt/opendj/logs/ -type f \( -name "access.*" -o -name "audit.*" -o -name "errors.*" -o -name "replication.*" -o -name "ldap-access.audit.json.*" \) -mtime +15 -delete
echo "Cleanup completed."
env:
- name: KUBERNETES_SERVICE_HOST
value: "kubernetes.default.svc"
- name: KUBERNETES_SERVICE_PORT
value: "443"
restartPolicy: OnFailure
```