How to set up log rotation
Log storage parameters in VictoriaLogs.
На этой странице
Where rotation is configured
Rotation parameters are set in the resource VLSingle of the VictoriaLogs component (API group operator.victoriametrics.com).
To configure VLSingle for a specific cluster, open the Management Cluster, then go to the side menu section Administration → Custom Resources. In the operator.victoriametrics.com API group, select the VLSingle resource, then open the VLSingle object in the namespace of the desired cluster.
About migrating CR during an update, see Transitions between versions.
Basic parameters
| Parameter | Description | Example |
|---|---|---|
retentionPeriod | Log storage period. Can take values from 1d (one day) to 100y (one hundred years) | 1d |
retention.maxDiskSpaceUsageBytes | Maximum disk capacity. If the specified volume is exceeded, the “earliest” logs for the past period will be deleted in accordance with the set storage period in retentionPeriod | 10MB |
storage.resources.requests.storage | Disk size for storing logs. When the specified volume is filled, logs stop being written | 3Gi |
Setting example
spec:
retentionPeriod: 1d
extraArgs:
retention.maxDiskSpaceUsageBytes: 10MB
storage:
resources:
requests:
storage: 3Gi
VLSingle sets retention only for VictoriaLogs in the management cluster. Configure /var/log/pods on the node and Vector disk buffers separately. See How to configure log collection buffers and Container logs fill the node disk.