{"record":{"id":"b9212d60c13d5be7","repo":"crowdsecurity/crowdsec","slug":"cannot-parse-victorialogs-acquisition-configuratio","errorCode":null,"errorMessage":"cannot parse VictoriaLogs acquisition configuration: %s","messagePattern":"cannot parse VictoriaLogs acquisition configuration: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/victorialogs/config.go","lineNumber":45,"sourceCode":"}\n\ntype Configuration struct {\n\tURL                               string              `yaml:\"url\"`    // VictoriaLogs url\n\tPrefix                            string              `yaml:\"prefix\"` // VictoriaLogs prefix\n\tQuery                             string              `yaml:\"query\"`  // LogsQL query\n\tLimit                             int                 `yaml:\"limit\"`  // Limit of logs to read\n\tSince                             time.Duration       `yaml:\"since\"`\n\tHeaders                           map[string]string   `yaml:\"headers\"`        // HTTP headers for talking to VictoriaLogs\n\tWaitForReady                      time.Duration       `yaml:\"wait_for_ready\"` // Retry interval, default is 10 seconds\n\tAuth                              AuthConfiguration `yaml:\"auth\"`\n\tMaxFailureDuration                time.Duration       `yaml:\"max_failure_duration\"` // Max duration of failure before stopping the source\n\tconfiguration.DataSourceCommonCfg `yaml:\",inline\"`\n}\n\nfunc (s *Source) UnmarshalConfig(yamlConfig []byte) error {\n\terr := yaml.UnmarshalWithOptions(yamlConfig, &s.Config, yaml.Strict())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot parse VictoriaLogs acquisition configuration: %s\", yaml.FormatError(err, false, false))\n\t}\n\n\tif s.Config.URL == \"\" {\n\t\treturn errors.New(\"VictoriaLogs url is mandatory\")\n\t}\n\n\tif s.Config.Query == \"\" {\n\t\treturn errors.New(\"VictoriaLogs query is mandatory\")\n\t}\n\n\tif s.Config.WaitForReady == 0 {\n\t\ts.Config.WaitForReady = 10 * time.Second\n\t}\n\n\tif s.Config.Mode == \"\" {\n\t\ts.Config.Mode = configuration.TAIL_MODE\n\t}\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/victorialogs/config.go#L27-L63","documentation":"UnmarshalConfig for the VictoriaLogs datasource failed to strict-parse the YAML stanza into the source configuration. With yaml.Strict(), any unknown or misspelled key causes an error; the message includes the yaml.FormattedError describing the exact offending field.","triggerScenarios":"A victorialogs acquisition stanza contains a field not in the Config struct (typo like 'urlrs', extra keys, wrong nesting), or a value with the wrong type (e.g. string where int expected).","commonSituations":"Copy-pasting an elasticsearch/Loki stanza and leaving stale keys; misspelling 'url', 'stream_fields', or 'mode'; version upgrades renaming a config key while the old key remains.","solutions":["Read the formatted error text — it names the unknown field or type mismatch; fix or remove that key.","Compare against the documented victorialogs fields: url, and DataSourceCommonCfg options (mode, labels, etc.).","Check indentation so unrelated keys are not inlined into this stanza.","Ensure required 'url' is present, since it is validated right after parsing."],"exampleFix":"// before\nsource: victorialogs\nurl: http://vl:9428\ntypo_field: true   # unknown key -> strict parse error\n\n// after\nsource: victorialogs\nurl: http://vl:9428","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"url\": true, \"mode\": true, \"labels\": true, \"log_level\": true, \"type\": true, \"name\": true}\nfor key := range stanza {\n    if !allowed[key] {\n        return fmt.Errorf(\"unknown victorialogs field %q\", key)\n    }\n}\nif stanza[\"url\"] == \"\" {\n    return errors.New(\"url is required\")\n}","typeGuard":null,"tryCatchPattern":"if err := yaml.UnmarshalWithOptions(b, &cfg, yaml.Strict()); err != nil {\n    log.Errorf(\"bad victorialogs stanza: %s\", yaml.FormatError(err, false, false))\n    return err\n}","preventionTips":["Check field names against current docs after crowdsec upgrades.","Remove keys copied from elasticsearch/loki stanzas.","Use strict parsing locally (or cscli dry run) to catch typos before deploy."],"tags":["config","yaml","victorialogs","validation"],"backgroundTag":"yaml-parse-error","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}