DOCA Services Fluent Logger
This guide provides instructions on how to use the logging infrastructure for DOCA services on top of NVIDIA® BlueField® DPU.
Fluent Bit is a fast log collector that collects information from multiple sources and then forwards the data onward using Fluent.
On NVIDIA DPUs, the Fluent Bit logger can be easily configured to collect system data and the logs from the different DOCA services.
The deployment is based on a recommended configuration template for the existing Fluent Bit container.
For information about the deployment of DOCA containers on top of the BlueField DPU, refer to NVIDIA DOCA Container Deployment Guide.
The following is an example YAML file for deploying the Fluent Bit pod:
            
            apiVersion: v1
kind: Pod
metadata:
  name: fluent-bit
spec:
  hostNetwork: true
  containers:
  - name: fluent-bit
    image: fluent/fluent-bit:latest
    imagePullPolicy: Always
    # Example resource definitions
    resources:
      requests:
        memory: "100Mi"
        cpu: "200m"
      limits:
        memory: "200Mi"
        cpu: "300m"
    volumeMounts:
    - name: varlog
      mountPath: /var/log
    - name: config-file
      mountPath: /fluent-bit/etc/fluent-bit.conf
  volumes:
  - name: varlog
    hostPath:
      path: /var/log
  - name: config-file
    hostPath:
      path: /opt/mellanox/doca/services/fluent-bit.conf
      type: File
        
    
As explained in the "Configuration" section, Fluent Bit uses a configuration file. As such, to ensure that the example YAML file is shared from the DPU to the deployed Fluent Bit container, use the following:
            
             path: /opt/mellanox/doca/services/fluent-bit.conf  
        
    
The path below is just an example for where the user can place the fluent-bit.conf file. The file could be placed in a different directory on the DPU as long as the YAML file points to the updated location.
The Fluent Bit configuration file should have the following sections:
[SERVICE]– to define the service specifications[INPU]– to define folders to collect logs from (there could be multiple inputs)[OUTPUT]– IP and port to stream the data to
Example configuration file:
            
            [SERVICE]
    Flush         2
    Log_Level     info
    Daemon        off
    Parsers_File  parsers.conf
    HTTP_Server   On
    HTTP_Listen   0.0.0.0
    HTTP_Port     2020
 
[INPUT]
    Name              tail
    Tag               kube.*
    Path              /var/log/containers/*.log
    Parser            docker
    Mem_Buf_Limit     5MB
    Skip_Long_Lines   On
    Refresh_Interval  10
 
[INPUT]
    Name              tail
    Tag               sys.*
    Path              /var/log/doca/*/*.log
    Mem_Buf_Limit     5MB
    Skip_Long_Lines   On
    Refresh_Interval  10
 
[OUTPUT]
    Name  es
    Match *
    Host 10.20.30.40
    Port 9201
    Index fluent_bit
    Type cpu_metrics
        
    
The most important field to pay attention to is Path for the INPUT section. DOCA services report their logs to a unique directory under /var/log/doca/<service_name>/*.log per the respective DOCA service. As such, the configuration above defines the /var/log/doca/*/*.log input definition.
More information about the full specifications can be found in the official Fluent Bit manual.
For container-related troubleshooting, refer to the "Troubleshooting" section in the NVIDIA DOCA Container Deployment Guide.
For general troubleshooting, refer to the DOCA Troubleshooting.
When copying the above YAML file, it is possible that the container infrastructure logs give an error related to RFC 1123". These errors are usually a result of a spacing error in the file, which sometimes occur when copying the file as is from this page. To fix this issue, make sure that only the space character (' ') is used as a spacer in the file and not other whitespace characters that might have been added during the copy operation.