{"record":{"id":"50479c2ce9d63fdc","repo":"crowdsecurity/crowdsec","slug":"unknown-level-s-w","errorCode":null,"errorMessage":"unknown level %s: %w","messagePattern":"unknown level (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/cloudwatch/config.go","lineNumber":234,"sourceCode":"\ts.Config.StreamName = &frags[1]\n\ts.Config.Labels = labels\n\ts.Config.UniqueId = uuid\n\n\tu, err := url.ParseQuery(args[1])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while parsing %s: %w\", dsn, err)\n\t}\n\n\tfor k, v := range u {\n\t\tswitch k {\n\t\tcase \"log_level\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one value for 'log_level'\")\n\t\t\t}\n\n\t\t\tlvl, err := log.ParseLevel(v[0])\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unknown level %s: %w\", v[0], err)\n\t\t\t}\n\n\t\t\ts.logger.Logger.SetLevel(lvl)\n\t\tcase \"profile\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one value for 'profile'\")\n\t\t\t}\n\n\t\t\tawsprof := v[0]\n\t\t\ts.Config.AwsProfile = &awsprof\n\t\t\ts.logger.Debugf(\"profile set to '%s'\", *s.Config.AwsProfile)\n\t\tcase \"start_date\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one argument for 'start_date'\")\n\t\t\t}\n\t\t\t// let's reuse our parser helper so that a ton of date formats are supported\n\t\t\tstrdate, startDate := parser.GenDateParse(v[0])\n\t\t\ts.logger.Debugf(\"parsed '%s' as '%s'\", v[0], strdate)","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/cloudwatch/config.go#L216-L252","documentation":"ConfigureByDSN parses the `log_level` DSN parameter with logrus' log.ParseLevel. If the value is not a valid level string (panic, fatal, error, warn, info, debug, trace), ParseLevel fails and the error is wrapped as `unknown level <value>: <underlying error>`. This is a configuration validation error: the datasource is not configured and acquisition aborts.","triggerScenarios":"Calling ConfigureByDSN with a DSN containing `log_level=verbose` or any misspelled/unrecognized level value, e.g. cloudwatch://group?log_level=verbose. Also triggered by empty or malformed values passed after the parameter name.","commonSituations":"Typo in a LogQL/logrus level name; copying levels from a different logging library (e.g. 'warn' vs 'warning' — logrus accepts 'warn' but not 'warning'); user assuming arbitrary verbosity strings are valid.","solutions":["Use a valid logrus level: panic, fatal, error, warn, info, debug or trace","Check the exact value in the acquisition config DSN for typos or whitespace","Omit the log_level parameter entirely to keep the default level"],"exampleFix":"// before\ncloudwatch://my-group?log_level=verbose\n// after\ncloudwatch://my-group?log_level=debug","handlingStrategy":"validation","validationCode":"level := \"debug\"\nif _, err := log.ParseLevel(level); err != nil {\n    return fmt.Errorf(\"invalid log_level %q: use panic|fatal|error|warn|info|debug|trace\", level)\n}","typeGuard":null,"tryCatchPattern":"err := ds.ConfigureByDSN(ctx, dsn)\nvar cfgErr *configError\nif errors.As(err, &cfgErr) { /* fix DSN and reload config */ }","preventionTips":["Keep a list of valid logrus levels in config templates","Lint acquisition DSNs before deploying","Prefer omitting log_level unless tuning verbosity"],"tags":["config","aws","logrus","cloudwatch"],"backgroundTag":"invalid-config-value","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"}