Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions geoserver/latest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.2.4

**Changes**

Add a CronJob to prune old logs daily.

**Commits**

Francesco Camuffo (1):
gs: add CronJob to prune old logs

## 0.2.3

**Changes**
Expand Down
2 changes: 1 addition & 1 deletion geoserver/latest/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.3
version: 0.2.4

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
77 changes: 77 additions & 0 deletions geoserver/latest/templates/cronjob-logs-pruning.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "geoserver.fullname" . }}-logs-pruning
labels:
{{- include "geoserver.labels" . | nindent 4 }}
spec:
schedule: '0 1 * * *'
jobTemplate:
metadata:
name: {{ include "geoserver.fullname" . }}-logs-pruning
spec:
template:
metadata: {}
spec:
restartPolicy: Never

containers:
- name: prune
image: busybox:1.37
imagePullPolicy: IfNotPresent

command:
- /bin/sh
- -eux
- -c
- |
date
printf "Pruning log files...\n\n"

if [ -d /var/geoserver/audits ]; then
find /var/geoserver/audits/ -name '*.log' -type f -mtime +14 -print -delete
fi

if [ -d /usr/local/tomcat/logs ]; then
find /usr/local/tomcat/logs/ -name '*.catalina.*.log' -type f -mtime +14 -print -delete
find /usr/local/tomcat/logs/ -name '*.host-manager.*.log' -type f -mtime +14 -print -delete
find /usr/local/tomcat/logs/ -name '*.localhost.*.log' -type f -mtime +14 -print -delete
find /usr/local/tomcat/logs/ -name '*.localhost_access_log.*.txt' -type f -mtime +14 -print -delete
find /usr/local/tomcat/logs/ -name '*.manager.*.log' -type f -mtime +14 -print -delete
fi

volumeMounts:
{{- if .Values.persistence.tomcatlogs }}
- name: gs-tomcatlogs
mountPath: /usr/local/tomcat/logs
{{- end }}
{{- if .Values.persistence.audits }}
- name: gs-audits
mountPath: /var/geoserver/audits
{{- end }}

{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}

volumes:
{{- if .Values.persistence.tomcatlogs }}
- name: gs-tomcatlogs
persistentVolumeClaim:
claimName: {{ include "geoserver.fullname" . }}-tomcatlogs
{{- end }}
{{- if .Values.persistence.audits }}
- name: gs-audits
persistentVolumeClaim:
claimName: {{ include "geoserver.fullname" . }}-audits
{{- end }}