Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vlogs: added option for retention by disk usage #1846

Merged
merged 1 commit into from
Dec 4, 2024
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
2 changes: 1 addition & 1 deletion charts/victoria-logs-single/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Next release

- TODO
- added `server.retentionDiskUsage` to control [retention by disk space](https://docs.victoriametrics.com/victorialogs/#retention-by-disk-space-usage). See [this issue](https://github.com/VictoriaMetrics/helm-charts/issues/1845)

## 0.8.9

Expand Down
11 changes: 11 additions & 0 deletions charts/victoria-logs-single/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,17 @@ timeoutSeconds: 5
</pre>
</td>
<td><p>Resource object. Details are <a href="http://kubernetes.io/docs/user-guide/compute-resources/" target="_blank">here</a></p>
</td>
</tr>
<tr>
<td>server.retentionDiskSpaceUsage</td>
<td>string</td>
<td><pre class="helm-vars-default-value" language-yaml" lang="">
<code class="language-yaml">""
</code>
</pre>
</td>
<td><p>Data retention max capacity. Default unit is GiB. See these <a href="https://docs.victoriametrics.com/victorialogs/#retention-by-disk-space-usage" target="_blank">docs</a></p>
</td>
</tr>
<tr>
Expand Down
15 changes: 14 additions & 1 deletion charts/victoria-logs-single/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@
{{- $Values := (.helm).Values | default .Values }}
{{- $app := $Values.server -}}
{{- $args := default dict -}}
{{- $_ := set $args "retentionPeriod" $app.retentionPeriod -}}
{{- if and (empty $app.retentionPeriod) (empty $app.retentionDiskSpaceUsage) -}}
{{- fail "either .Values.server.retentionPeriod or .Values.server.retentionDiskSpaceUsage should be defined" -}}
{{- end -}}
{{- with $app.retentionPeriod -}}
{{- $_ := set $args "retentionPeriod" $app.retentionPeriod -}}
{{- end -}}
{{- with $app.retentionDiskSpaceUsage -}}
{{- $retentionDiskSpaceUsage := int $app.retentionDiskSpaceUsage -}}
{{- if $retentionDiskSpaceUsage -}}
{{- $_ := set $args "retention.maxDiskSpaceUsageBytes" (printf "%dGiB" $retentionDiskSpaceUsage) -}}
{{- else -}}
{{- $_ := set $args "retention.maxDiskSpaceUsageBytes" $app.retentionDiskSpaceUsage -}}
{{- end -}}
{{- end -}}
{{- $_ := set $args "storageDataPath" $app.persistentVolume.mountPath -}}
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
{{- $args = mergeOverwrite $args $app.extraArgs -}}
Expand Down
2 changes: 2 additions & 0 deletions charts/victoria-logs-single/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ server:
priorityClassName: ""
# -- Data retention period. Possible units character: h(ours), d(ays), w(eeks), y(ears), if no unit character specified - month. The minimum retention period is 24h. See these [docs](https://docs.victoriametrics.com/victorialogs/#retention)
retentionPeriod: 1
# -- Data retention max capacity. Default unit is GiB. See these [docs](https://docs.victoriametrics.com/victorialogs/#retention-by-disk-space-usage)
retentionDiskSpaceUsage: ""
# -- Extra command line arguments for container of component
extraArgs:
envflag.enable: true
Expand Down
Loading