Troubleshooting logging
Logs are not displayed, Vector does not collect.
If logs do not appear on the Logs tab of the cluster dashboard, check collection and storage using the scenarios below.
Logs are not displayed
- Ensure the local log collection module (
shturval-log-collector, Vector) is enabled in the cluster. - Verify that shturval-metrics-collector (monitoring module management / log storage component) is running in the management cluster.
- Check the VictoriaLogs instance for the cluster (
VLSinglecustom resource in the cluster namespace in the management cluster). - Verify pod status (Running, Ready) and namespaces:
shturval-log-collectorin the cluster namespace;shturval-metrics-collectorand VictoriaLogs in the management cluster.
Logs are not received
- Check
shturval-log-collectorand VictoriaLogs pods (cluster namespace and management cluster). - Review Vector logs (
shturval-log-collector). - Ensure cluster pods write logs to stdout/stderr.
- Verify network connectivity between Vector and VictoriaLogs.
Storage full
- Set up log rotation in VictoriaLogs (
retentionPeriod); - Reduce retention or the volume of logs collected.
VictoriaLogs rotation does not limit the container log directory on the node.
Container logs fill the node disk
A separate disk partition and a project quota for /var/log/pods can be set in the node image and in its configuration. How Vector buffers work and what happens when a buffer is full is described on How to configure log collection buffers.
If log storage is unavailable and a platform log receiver has when_full: block enabled, the agent waits for space in its buffer and does not close files in /var/log/pods that kubelet has already deleted. While such a file stays open, the blocks and inodes it occupies are not returned to the disk. When free space on the node disk runs out, containers stop writing files and new pods do not start.
A pod ephemeral-storage limit does not apply to /var/log: the agent mounts this directory from the node disk (hostPath), not from its own pod. If the Vector pod is evicted, files that its process still holds open are not closed.
Diagnosis
On the node, check block and inode usage. Deleted files that Vector still holds are shown in lsof +L1 for the vector command (the agent process is visible in the node PID namespace):
df -h /var/log/pods /var/lib/vector
df -i /var/log/pods /var/lib/vector
lsof +L1 -c vector
lsof +L1 lists open files with a link count of 0. Those files are already deleted. If the node has several vector processes, use the one whose open files are under /var/log/pods.
Partition or project quota
Pick one way to isolate /var/log/pods.
- A separate partition. The directory gets its own blocks and inode table. A size around 5 GiB is a starting point. Match it to kubelet rotation and to the number of containers on the node.
- A project quota on the shared volume. The limit is assigned to the project id of the directory tree. Set both a block limit and an inode limit. The numbers in the commands below are a starting point, not a platform default.
Alert on blocks and inodes. Kubelet treats the filesystem with /var/lib/kubelet and logs as nodefs. A separate mount may be missing from Capacity and eviction. A quota caps usage but does not close descriptors. With when_full: block and a full buffer, the source loop can stall. The quota or partition then keeps the node usable.
Project quota on XFS
mount -o prjquota /dev/SDX /var
xfs_quota -x -c 'project -s -p /var/log/pods 42' /var
xfs_quota -x -c 'limit -p bhard=5g ihard=100000 42' /var
Project quota on ext4
Enable the filesystem features first. Here 5242880 is 5 GiB in 1 KiB blocks.
tune2fs -O project,quota /dev/SDX
mount -o prjquota /dev/SDX /var
chattr +P -p 42 /var/log/pods
setquota -P 42 0 5242880 0 100000 /var
quotaon -Pv /var
When the quota is reached, writes into the tree get EDQUOT or ENOSPC. The root filesystem can still have free space.
Kubelet log rotation
The maximum space container logs can occupy on the node disk in /var/log/pods is calculated as follows: the number of containers on the node is multiplied by containerLogMaxSize and by containerLogMaxFiles, then headroom is added for files that Vector still holds.
If those keys are absent from the kubelet configuration, kubelet uses the Kubernetes defaults: containerLogMaxSize 10Mi and containerLogMaxFiles 5. That is about 50 MiB of visible logs per container. Rotation limits visible files. It does not free inodes that Vector still holds after the file is deleted.
Set the keys in the node image or node configuration. The platform has no custom resource for these parameters.
An example, not a platform default. About 90 containers, containerLogMaxSize 50Mi, and containerLogMaxFiles 4 give about 4.5 GiB of visible logs. The directory ceiling is then about 5 GiB.
About 1 GiB on /var/lib/vector is a starting point for agent checkpoints.
containerd and feature gates
A quota on /var/log/pods relies on the kernel and a filesystem with prjquota. containerd and kubelet write files into that directory.
LocalStorageCapacityIsolationFSQuotaMonitoring uses project quotas to account for emptyDir and does not limit /var/log/pods.
Align with Vector buffers
Do not raise buffer.max_size on platform sinks until /var/lib/vector is isolated. After /var/log/pods is isolated, block keeps events and does not let log growth consume the root filesystem. Choose drop_newest only when losing new events is acceptable. See the SSP examples.
Check
- Record
df,df -i, andlsof +L1for/var/log/podsand/var/lib/vectorbefore the receiver outage. - Stop the receiver for longer than it takes to fill a buffer of about 256 MiB.
- The root filesystem still has free blocks and inodes. New pods create files and start. Growth of
/var/log/podsstops at the partition or quota size. - With
block, discarded events appear in metrics only when the agent has internal metrics enabled; otherwise uselsof +L1anddf. If the source loop is not blocked, the number of deleted files inlsof +L1does not keep growing pastrotate_wait_secs(60 seconds). If the loop is stalled, the quota or the partition holds the node. - With
drop_newest, discarded events appear in metrics only when the agent has internal metrics enabled; otherwise uselsof +L1anddf. The number of deleted files held by Vector should not grow pastrotate_wait_secs. - After the receiver returns, the buffer shrinks. Adaptive concurrency should not knock the receiver over again with a burst from several agents.
See also
- Platform administrator logs - architecture, Vector pipelines, integration with external storages
- How to configure log collection buffers -
when_full, adaptive concurrency, the/var/lib/vectordirectory - How to set up log rotation - VictoriaLogs retention
- How to redirect logs - setting up sinks and
platform_logs_sink