VictoriaLogs Collector - collects logs from Kubernetes containers and stores them to VictoriaLogs
Prerequisites #
Before installing this chart, ensure your environment meets the following requirements:
- Kubernetes cluster - A running Kubernetes cluster with sufficient resources
- Helm - Helm package manager installed and configured
Additional requirements depend on your configuration:
- Persistent storage - Required if you enable persistent volumes for data retention (enabled by default)
- kubectl - Needed for cluster management and troubleshooting
For installation instructions, refer to the official documentation:
Quick start #
This Helm chart deploys a log collection agent as a DaemonSet. It collects logs from all containers in a Kubernetes cluster and forwards them to the configured VictoriaLogs destinations. If more than one destination is specified, then the collected logs are replicated among the configured destinations.
This chart will expand its functionality as the corresponding features are added to vlagent .
- To quickly install single-node version of VictoriaLogs and
victoria-logs-collector, see these docs . - To start with a VictoriaLogs cluster and
victoria-logs-collector, see these docs .
Chart configuration #
The simplest working configuration includes specifying the remoteWrite array and setting CPU and memory resources for the chart.
Example of a minimal working configuration:
remoteWrite:
- url: http://victoria-logs:9428
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
If multiple remoteWrite entries are defined, logs are replicated to all the specified destinations.
Basic auth #
If you need to use basic auth, define the secrets via environment variables as shown below:
remoteWrite:
- url: http://victoria-logs:9428
env:
- name: VL_remoteWrite_basicAuth_password
valueFrom:
secretKeyRef:
name: auth-secret
key: VL_PASSWORD
- name: VL_remoteWrite_basicAuth_username
valueFrom:
secretKeyRef:
name: auth-secret
key: VL_USERNAME
Multitenancy #
To define
tenant
, set ProjectID and AccountID headers as shown below:
remoteWrite:
- url: http://localhost:9428
headers:
ProjectID: 12
AccountID: 42
TLS #
To enable TLS verification for the remoteWrite target, you can specify the tls-prefixed params inside each remoteWrite entry.
At a minimum, you should provide the tlsCAFile path so that the collector can verify the server’s TLS certificate.
This is useful when the target endpoint uses a certificate signed by a custom or self-signed Certificate Authority (CA).
remoteWrite:
- url: https://victoria-logs:9428
tlsCAFile: /etc/tls/ca.crt
extraVolumes:
- name: tls-certs
secret:
secretName: tls-secret
extraVolumeMounts:
- name: tls-certs
mountPath: /etc/tls
readOnly: true
If you want to disable TLS certificate verification (not recommended in production), you can set tlsInsecureSkipVerify to true.
This will skip verification of the server’s certificate and allow connecting to targets with self-signed or invalid certificates.
remoteWrite:
- url: https://victoria-logs:9428
tlsInsecureSkipVerify: true
Ignore fields #
VictoriaLogs efficiently compresses repeated values, such as pod and node labels.
However, if you prefer not to store certain fields, you can ignore them using the VL-Ignore-Fields header.
For example:
remoteWrite:
- url: http://victoria-logs:9428
headers:
VL-Ignore-Fields:
- file
- kubernetes.container_id
- kubernetes.pod_annotations*
- kubernetes.node_labels*
- kubernetes.namespace_labels*
- kubernetes.pod_labels*
This allows you to exclude unnecessary or sensitive fields from being ingested. If sensitive data has already been ingested, see how to exclude logs from search result .
Extra fields #
You can add custom fields to your logs by setting the VL-Extra-Fields header in your configuration.
For example:
remoteWrite:
- url: http://victoria-logs:9428/
headers:
VL-Extra-Fields:
zone: us-east1-c
source: victoria-logs-collector
This feature lets you attach metadata to every log entry, making it easier to filter, group, or analyze logs based on these additional attributes.
How to install #
Access a Kubernetes cluster.
Setup chart repository (can be omitted for OCI repositories) #
Add a chart helm repository with follow commands:
helm repo add vm https://victoriametrics.github.io/helm-charts/
helm repo update
List versions of vm/victoria-logs-collector chart available to installation:
helm search repo vm/victoria-logs-collector -l
Install victoria-logs-collector chart
#
Export default values of victoria-logs-collector chart to file values.yaml:
For HTTPS repository
helm show values vm/victoria-logs-collector > values.yamlFor OCI repository
helm show values oci://ghcr.io/victoriametrics/helm-charts/victoria-logs-collector > values.yaml
Change the values according to the need of the environment in values.yaml file.
Consider setting .Values.nameOverride to a small value like vlc to avoid hitting resource name limits of 63 characters
Test the installation with command:
For HTTPS repository
helm install vlc vm/victoria-logs-collector -f values.yaml -n NAMESPACE --debugFor OCI repository
helm install vlc oci://ghcr.io/victoriametrics/helm-charts/victoria-logs-collector -f values.yaml -n NAMESPACE --debug
Install chart with command:
For HTTPS repository
helm install vlc vm/victoria-logs-collector -f values.yaml -n NAMESPACEFor OCI repository
helm install vlc oci://ghcr.io/victoriametrics/helm-charts/victoria-logs-collector -f values.yaml -n NAMESPACE
Get the pods lists by running this commands:
kubectl get pods -A | grep 'vlc'
Get the application by running this command:
helm list -f vlc -n NAMESPACE
See the history of versions of vlc application with command.
helm history vlc -n NAMESPACE
How to uninstall #
Remove application with command.
helm uninstall vlc -n NAMESPACE
Documentation of Helm Chart #
Install helm-docs following the instructions on this
tutorial
.
Generate docs with helm-docs command.
cd charts/victoria-logs-collector
helm-docs
The markdown generation is entirely go template driven. The tool parses metadata from charts and generates a number of sub-templates that can be referenced in a template file (by default README.md.gotmpl). If no template file is provided, the tool has a default internal template that will generate a reasonably formatted README.
Parameters #
The following tables lists the configurable parameters of the chart and their default values.
Change the values according to the need of the environment in victoria-logs-collector/values.yaml file.
| Key | Description |
|---|---|
| (object)Pod affinity |
| (object)Annotations to be added to the deployment |
| (object)List of collector specific properties |
| (string)LogsQL filter for excluding container logs. The filter is applied to container metadata fields (e.g., kubernetes.namespace_name, kubernetes.container_name) before reading the log files. This significantly reduces CPU and I/O usage by skipping logs from unwanted containers. See https://docs.victoriametrics.com/victorialogs/vlagent/#filtering-kubernetes-logs |
| (bool)Include Node annotations as additional fields in the log entries. Even this setting is disabled, Node annotations are available for filtering via .Values.excludeFilter parameter |
| (bool)Include Node labels as additional fields in the log entries. Even this setting is disabled, Node labels are available for filtering via .Values.excludeFilter parameter |
| (bool)Include Pod annotations as additional fields in the log entries. Even this setting is disabled, Pod annotations are available for filtering via .Values.excludeFilter parameter |
| (bool)Include Pod labels as additional fields in the log entries. Even this setting is disabled, Pod labels are available for filtering via .Values.excludeFilter parameter |
| (list)List of fields to be used as |
| (list)List of fields to be used as |
| (list)Environment variables (ex.: secret tokens). |
| (list)Extra Volume Mounts for the container |
| (list)Extra Volumes for the pod |
| (string)Override resources fullname |
| (string)K8s cluster domain suffix, used for building storage pods’ FQDN. Details are here |
| (object)Openshift security context compatibility configuration |
| (string)Image registry, that can be shared across multiple helm charts |
| (list)Image pull secrets, that can be shared across multiple helm charts |
| (string)Image pull policy |
| (string)Image registry |
| (string)Image repository |
| (string)Image tag |
| (string)Image tag suffix, which is appended to |
| (string)Override chart name |
| (object)Pod’s node selector. Details are here |
| (object)Annotations to be added to pod |
| (object)Extra labels for Pods only |
| (object)PodMonitor annotations |
| (bool)Enable PodMonitor |
| (object)PodMonitor labels |
| (bool)Whether to use VMPodScrape from VM operator instead of PodMonitor |
| (object)Security context to be added to pod |
| (string)Priority class to be assigned to the pod(s) |
| (list)List of log destinations. Logs will be replicated to all listed destinations. If the url path is not specified, the logs will be sent to the /insert/native endpoint. |
| (string) |
| (object)Security context to be added to pod’s containers |
| (object)Service account is needed to enrich logs with pod metadata using Kubernetes API |
| (list)Node tolerations for server scheduling to nodes with taints. Details are here |
| (string)Pod topologySpreadConstraints |