Skip to content

Commit

Permalink
vlogs: added option for retention by disk usage (#1846)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewChubatiuk authored Dec 4, 2024
1 parent a20dc03 commit f502b62
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
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

0 comments on commit f502b62

Please sign in to comment.