{"record":{"id":"72f364a95f071c96","repo":"crowdsecurity/crowdsec","slug":"empty-host","errorCode":null,"errorMessage":"empty host","messagePattern":"empty host","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/victorialogs/config.go","lineNumber":134,"sourceCode":"\nfunc (s *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string]string, logger *log.Entry, uuid string) error {\n\ts.logger = logger\n\ts.Config = Configuration{}\n\ts.Config.Mode = configuration.CAT_MODE\n\ts.Config.Labels = labels\n\ts.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 != \"victorialogs\" {\n\t\treturn fmt.Errorf(\"invalid DSN %s for VictoriaLogs source, must start with victorialogs://\", dsn)\n\t}\n\n\tif u.Host == \"\" {\n\t\treturn errors.New(\"empty host\")\n\t}\n\n\tscheme := \"http\"\n\n\tparams := u.Query()\n\n\tif q := params.Get(\"ssl\"); q != \"\" {\n\t\tscheme = \"https\"\n\t}\n\n\tif q := params.Get(\"query\"); q != \"\" {\n\t\ts.Config.Query = q\n\t}\n\n\tif w := params.Get(\"wait_for_ready\"); w != \"\" {\n\t\ts.Config.WaitForReady, err = time.ParseDuration(w)\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/victorialogs/config.go#L116-L152","documentation":"When a VictoriaLogs datasource is configured via DSN string (victorialogs://...), ConfigureByDSN parses it as a URL and requires a host portion identifying the VictoriaLogs server. A DSN like 'victorialogs://' with no host returns 'empty host'.","triggerScenarios":"DSN of the form 'victorialogs://' or 'victorialogs:///path' with no authority component in the acquisition config's 'source:' field.","commonSituations":"Incomplete DSN left in acquis.d/config after copying docs; host removed when templating; missing scheme+host because the user pasted only the path.","solutions":["Add the host to the DSN: victorialogs://victorialogs:9428","Include the full address with port if non-default","If config is generated, check the template renders the host variable"],"exampleFix":"// before\nsource: victorialogs://\n// after\nsource: victorialogs://victorialogs:9428","handlingStrategy":"validation","validationCode":"// validate DSN shape before use\nu, err := url.Parse(dsn)\nif err != nil || u.Scheme != \"victorialogs\" || u.Host == \"\" { return errors.New(\"DSN must be victorialogs://host[:port]\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy full DSN examples including host and port from docs","Check that generated configs render host variables","Test DSN parsing with cscli/starting crowdsec before restart"],"tags":["dsn","configuration","victorialogs"],"backgroundTag":"invalid-url","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"}