vectordotdev / helm-charts

Helm charts for Vector.
https://vector.dev
Mozilla Public License 2.0
102 stars 89 forks source link

Crashloop with invalid type from configuration #192

Closed nlamirault closed 2 years ago

nlamirault commented 2 years ago

Hi, I try to check Vector on my K3S homelab. I set the Helm chart values like that:

  role: "Agent"
  resources:
    requests:
      cpu: 50m
      memory: 64Mi
    limits:
      cpu: 100m
      memory: 256Mi

  dataDir: "/var/lib/vector"
  customConfig:
    api:
      enabled: true
      address: 127.0.0.1:8686
      playground: false
    sources:
      kubernetes:
        type: kubernetes_logs
    sinks:
      console:
        type: console
        inputs:
          - kubernetes
        target: stdout
        encoding: null

All pod crashloop with this error :

❯ kubectl -n logging logs -f test-vector-vjz6c                                                                                                                                                                                                                                                                               2022-04-04T09:10:08.474056Z  INFO vector::app: Log level is enabled. level="vector=info,codec=info,vrl=info,file_source=info,tower_limit=trace,rdkafka=info,buffers=info"                                                                                                                                                    
2022-04-04T09:10:08.474927Z  INFO vector::app: Loading configs. paths=["/etc/vector"]                                                                                                                                                                                                                                        
2022-04-04T09:10:08.572399Z ERROR vector::cli: Configuration error. error=sinks.console: invalid type: unit value, expected string or map at line 7 column 13

Any idea about a configuration problem ? Thanks.

spencergilbert commented 2 years ago

Hi @nlamirault - sinks.console.encoding.codec is actually required to be set to either json (for the entire event) or text for just the .message field to be printed. However that's not reflected on the site currently, I'll try and put a fix in for that today.

Let me know if you have any other issues!

spencergilbert commented 2 years ago

https://github.com/vectordotdev/vector/pull/11645 <- was merged earlier to fix the config examples section, I just cherry-picked it into the live docs version https://github.com/vectordotdev/vector/pull/11535 <- noting here, that the way we're currently generating the documentation doesn't pass the required field properly into object children. There's a JIRA issue open to have one of our web/docs people take a look at fixing the code there.

nlamirault commented 2 years ago

Thanks @spencergilbert I will try that.

nlamirault commented 2 years ago

it works fine. Thanks

nlamirault commented 2 years ago

I try to enable LogDNA sink like that:

    sinks:
      console:
        type: console
        inputs:
          - kubernetes
        target: stdout
        encoding:
          codec: json
      logdna:
        type: logdna
        inputs:
          - kubernetes
        api_key: "${LOGDNA_API_KEY}"
        hostname: portefaix-homelab
        healthcheck:
          enabled: true

And pod crashloop with this logs :

✖ kubectl -n logging logs -f test-vector-4r5vt                                                                                                                                                                                              2022-04-05T07:14:22.368086Z  INFO vector::app: Log level is enabled. level="vector=info,codec=info,vrl=info,file_source=info,tower_limit=trace,rdkafka=info,buffers=info"                                                                    
2022-04-05T07:14:22.368899Z  INFO vector::app: Loading configs. paths=["/etc/vector"]                                                                                                                                                        
2022-04-05T07:14:22.463302Z ERROR vector::cli: Configuration error. error=sinks.logdna: invalid type: unit value, expected a string at line 14 column 12   

Any idea @spencergilbert ?

spencergilbert commented 2 years ago

The error messages that bubble up from our serializing/deserializing of the config leave much to be desired...

Looking at the configuration options for that sink my initial thinking would be that LOGDNA_API_KEY isn't getting set? Could you share your full values.yaml?

nlamirault commented 2 years ago

Ok bad configuration for the secret. So environment variable is not correctly set. Thanks.