Skip to content

Commit d6876f6

Browse files
author
Silvia
authored
Merge pull request #365 from maykinmedia/feature/remove-clean-log-script
🔥 Replace clean-logs script with django-timeline-entries management command
2 parents f1b95c5 + 2d72fb2 commit d6876f6

7 files changed

Lines changed: 34 additions & 93 deletions

File tree

charts/openforms/CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# Changelog
22

3+
## 1.12.0 (2026-02-09)
4+
5+
- Remove the config map with the clean-logs script. Since version `2.7.0` of the Open Forms app, it is not needed to prune the emails, while from `3.3.0`, Open Forms uses version `5.0.0` of `django-timeline-logger`, which includes a management command to prune the logs. The cronjob now uses this command instead of the script.
6+
7+
**Note**: the command in `django-timeline-logger` deletes the requested logs in one go, so if there are too many logs to delete, the job might be OOM killed.
8+
9+
310
## 1.11.6 (2025-12-11)
4-
- upgraded open-forms from 3.3.0 to 3.3.9
5-
- includes patch for CVE-2025-64515
11+
12+
- Upgraded open-forms app version from 3.3.0 to 3.3.9 (which includes a patch for CVE-2025-64515)
613

714
## 1.11.5 (2025-11-12)
815

charts/openforms/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Snel en eenvoudig slimme formulieren bouwen en publiceren
44

55
type: application
66

7-
version: 1.11.6
7+
version: 1.12.0
88
appVersion: 3.3.9
99

1010
icon: https://open-forms.readthedocs.io/en/stable/_static/logo.svg

charts/openforms/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Snel en eenvoudig slimme formulieren bouwen en publiceren
44

5-
![Version: 1.11.6](https://img.shields.io/badge/Version-1.11.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.3.9](https://img.shields.io/badge/AppVersion-3.3.9-informational?style=flat-square)
5+
![Version: 1.12.0](https://img.shields.io/badge/Version-1.12.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.3.9](https://img.shields.io/badge/AppVersion-3.3.9-informational?style=flat-square)
66

77
## Introduction
88

@@ -74,6 +74,13 @@ settings:
7474

7575
The value of the `DSN` is considered sensitive, so it should be handled as a secret.
7676

77+
### Cleaning up logs
78+
79+
It is possible to schedule a `CronJob` resource to clean up Timeline log entries. In order to enable it, set the value `settings.cleanLogs.enabled: true`.
80+
You can configure the number of days for which the logs should be kept by specifying `settings.cleanLogs.daysRetained`. A value of `90` will keep all the logs newer than `90` days.
81+
82+
Note that if you have accumulated a large number of logs, it is possible that the job might be OOM killed. Keep an eye on it to make sure that logs are properly deleted.
83+
7784
### Open Telemetry
7885

7986
Open Forms supports the Open Telemetry Protocol.
@@ -269,9 +276,9 @@ The static file serving feature uses the existing media PVC with subPaths to org
269276
| settings.celery.resultBackend | string | `""` | |
270277
| settings.cleanLogs.cronjob.historyLimit | int | `1` | |
271278
| settings.cleanLogs.cronjob.resources | object | `{}` | |
272-
| settings.cleanLogs.cronjob.schedule | string | `"0 0 * * *"` | Schedule to run the clean logs cronjob |
279+
| settings.cleanLogs.cronjob.schedule | string | `"0 0 * * *"` | Schedule to run the clean logs cronjob. The default will run the job every day at 00:00 |
273280
| settings.cleanLogs.daysRetained | int | `90` | Number of days to retain logs |
274-
| settings.cleanLogs.enabled | bool | `false` | Clean Logs, Messages, Timelog Entries |
281+
| settings.cleanLogs.enabled | bool | `false` | Clean Timeline Log entries |
275282
| settings.cookieSamesite | string | `""` | Choises Strict or Lax |
276283
| settings.cors.allowAllOrigins | bool | `false` | |
277284
| settings.cors.allowedOrigins | list | `[]` | |

charts/openforms/README.md.gotmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ settings:
6969

7070
The value of the `DSN` is considered sensitive, so it should be handled as a secret.
7171

72+
### Cleaning up logs
73+
74+
It is possible to schedule a `CronJob` resource to clean up Timeline log entries. In order to enable it, set the value `settings.cleanLogs.enabled: true`.
75+
You can configure the number of days for which the logs should be kept by specifying `settings.cleanLogs.daysRetained`. A value of `90` will keep all the logs newer than `90` days.
76+
77+
Note that if you have accumulated a large number of logs, it is possible that the job might be OOM killed. Keep an eye on it to make sure that logs are properly deleted.
78+
7279
### Open Telemetry
7380

7481
Open Forms supports the Open Telemetry Protocol.

charts/openforms/templates/clean-script.yaml

Lines changed: 0 additions & 74 deletions
This file was deleted.

charts/openforms/templates/cronjob-clean-logs.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ spec:
4444
- configMapRef:
4545
name: {{ include "openforms.fullname" . }}
4646
env:
47+
- name: OTEL_SDK_DISABLED
48+
value: "true"
4749
{{- if .Values.extraEnvVars }}
4850
{{- include "openforms.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 16 }}
4951
{{- end }}
@@ -52,18 +54,14 @@ spec:
5254
command:
5355
- "/bin/bash"
5456
- "-c"
55-
56-
- /app/src/manage.py shell < /app/scripts/clean_logs.py
57+
- /app/src/manage.py prune_timeline_logs --no-input --keep-days {{ .Values.settings.cleanLogs.daysRetained }}
5758
volumeMounts:
5859
- name: media
5960
mountPath: /app/private_media
6061
subPath: {{ .Values.persistence.privateMediaMountSubpath | default "openforms/private_media" }}
6162
- name: media
6263
mountPath: /app/media
63-
subPath: {{ .Values.persistence.mediaMountSubpath | default "openforms/media" }}
64-
- name: clean-logs
65-
mountPath: /app/scripts/
66-
readOnly: true
64+
subPath: {{ .Values.persistence.mediaMountSubpath | default "openforms/media" }}
6765
{{- if .Values.extraVolumeMounts }}
6866
{{- include "openforms.tplvalues.render" ( dict "value" .Values.extraVolumeMounts "context" $ ) | nindent 16 }}
6967
{{- end }}
@@ -74,11 +72,7 @@ spec:
7472
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ include "openforms.fullname" . }}{{- end }}
7573
{{- else }}
7674
emptyDir: { }
77-
{{- end }}
78-
- name: clean-logs
79-
configMap:
80-
name: {{ include "openforms.fullname" . }}-clean-logs
81-
defaultMode: 0755
75+
{{- end }}
8276
{{- if .Values.extraVolumes }}
8377
{{- include "openforms.tplvalues.render" ( dict "value" .Values.extraVolumes "context" $ ) | nindent 12 }}
8478
{{- end }}

charts/openforms/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,12 @@ settings:
366366
escapeRegistrationOutput: false
367367

368368
cleanLogs:
369-
# -- Clean Logs, Messages, Timelog Entries
369+
# -- Clean Timeline Log entries
370370
enabled: false
371371
# -- Number of days to retain logs
372372
daysRetained: 90
373373
cronjob:
374-
# -- Schedule to run the clean logs cronjob
374+
# -- Schedule to run the clean logs cronjob. The default will run the job every day at 00:00
375375
schedule: "0 0 * * *"
376376
historyLimit: 1
377377
resources: {}

0 commit comments

Comments
 (0)