Version ArtifactHub License Slack X Reddit

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.yaml
    
        
  • For 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.

Note

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 --debug
    
        
  • For 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 NAMESPACE
    
        
  • For 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.

KeyDescription
affinity: {}
(object)

Pod affinity

annotations: {}
(object)

Annotations to be added to the deployment

collector:
    excludeFilter: ""
    includeNodeAnnotations: false
    includeNodeLabels: false
    includePodAnnotations: false
    includePodLabels: true
    msgField:
        - message
        - msg
    timeField:
        - time
        - ts
        - timestamp
(object)

List of collector specific properties

collector.excludeFilter: ""
(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

collector.includeNodeAnnotations: false
(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

collector.includeNodeLabels: false
(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

collector.includePodAnnotations: false
(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

collector.includePodLabels: true
(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

collector.msgField:
    - message
    - msg
(list)

List of fields to be used as _msg field. The first found field will be used. See https://docs.victoriametrics.com/victorialogs/keyconcepts/#message-field for more details.

collector.timeField:
    - time
    - ts
    - timestamp
(list)

List of fields to be used as _time field. The first found field will be used. See https://docs.victoriametrics.com/victorialogs/keyconcepts/#time-field for more details.

env: []
(list)

Environment variables (ex.: secret tokens).

extraVolumeMounts: []
(list)

Extra Volume Mounts for the container

extraVolumes: []
(list)

Extra Volumes for the pod

fullnameOverride: ""
(string)

Override resources fullname

global.cluster.dnsDomain: cluster.local.
(string)

K8s cluster domain suffix, used for building storage pods’ FQDN. Details are here

global.compatibility:
    openshift:
        adaptSecurityContext: auto
(object)

Openshift security context compatibility configuration

global.image.registry: ""
(string)

Image registry, that can be shared across multiple helm charts

global.imagePullSecrets: []
(list)

Image pull secrets, that can be shared across multiple helm charts

image.pullPolicy: IfNotPresent
(string)

Image pull policy

image.registry: ""
(string)

Image registry

image.repository: victoriametrics/vlagent
(string)

Image repository

image.tag: ""
(string)

Image tag

image.variant: ""
(string)

Image tag suffix, which is appended to Chart.AppVersion if no server.image.tag is defined

nameOverride: ""
(string)

Override chart name

nodeSelector: {}
(object)

Pod’s node selector. Details are here

podAnnotations: {}
(object)

Annotations to be added to pod

podLabels: {}
(object)

Extra labels for Pods only

podMonitor.annotations: {}
(object)

PodMonitor annotations

podMonitor.enabled: false
(bool)

Enable PodMonitor

podMonitor.extraLabels: {}
(object)

PodMonitor labels

podMonitor.vm: false
(bool)

Whether to use VMPodScrape from VM operator instead of PodMonitor

podSecurityContext:
    enabled: true
(object)

Security context to be added to pod

priorityClassName: ""
(string)

Priority class to be assigned to the pod(s)

remoteWrite: []
(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.

resources: null
(string)
securityContext:
    enabled: true
(object)

Security context to be added to pod’s containers

serviceAccount:
    annotations: {}
    automount: true
    name: ""
(object)

Service account is needed to enrich logs with pod metadata using Kubernetes API

tolerations: []
(list)

Node tolerations for server scheduling to nodes with taints. Details are here

topologySpreadConstraints: null
(string)

Pod topologySpreadConstraints