{"record":{"id":"2ea0bbedd33c7f5a","repo":"crowdsecurity/crowdsec","slug":"invalid-dsn-s-for-loki-source-must-start-with-lo","errorCode":null,"errorMessage":"invalid DSN %s for loki source, must start with loki://","messagePattern":"invalid DSN (.+?) for loki source, must start with loki://","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/loki/config.go","lineNumber":129,"sourceCode":"\tl.Client.Logger = logger.WithFields(log.Fields{\"component\": \"lokiclient\", \"source\": l.Config.URL})\n\n\treturn nil\n}\n\nfunc (l *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string]string, logger *log.Entry, uuid string) error {\n\tl.logger = logger\n\tl.Config = Configuration{}\n\tl.Config.Mode = configuration.CAT_MODE\n\tl.Config.Labels = labels\n\tl.Config.UniqueId = uuid\n\n\tu, err := url.Parse(dsn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while parsing dsn '%s': %w\", dsn, err)\n\t}\n\n\tif u.Scheme != \"loki\" {\n\t\treturn fmt.Errorf(\"invalid DSN %s for loki source, must start with loki://\", dsn)\n\t}\n\n\tif u.Host == \"\" {\n\t\treturn errors.New(\"empty loki host\")\n\t}\n\n\tscheme := \"http\"\n\n\tparams := u.Query()\n\tif q := params.Get(\"ssl\"); q != \"\" {\n\t\tscheme = \"https\"\n\t}\n\n\tif q := params.Get(\"query\"); q != \"\" {\n\t\tl.Config.Query = q\n\t}\n\n\tif w := params.Get(\"wait_for_ready\"); w != \"\" {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/loki/config.go#L111-L147","documentation":"ConfigureByDSN of the loki source requires the URL scheme to be 'loki'; a DSN with a different scheme (e.g. http:// or https:// given directly) is not accepted and must be rewritten as loki:// or loki+https://.","triggerScenarios":"Thrown at pkg/acquisition/modules/loki/config.go:129 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Prefix the DSN with loki:// in the acquisition config","Ensure the DSN is assigned to the loki source, not another source type"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}