crowdsecurity/crowdsec · error

invalid DSN %s for VictoriaLogs source, must start with vict

Error message

invalid DSN %s for VictoriaLogs source, must start with victorialogs://

What it means

ConfigureByDSN parsed the DSN but its scheme is not 'victorialogs'. The VictoriaLogs datasource only accepts DSNs of the form victorialogs://host[:port], so any http://, https:// or other scheme is rejected explicitly.

Source

Thrown at pkg/acquisition/modules/victorialogs/config.go:130

	s.Client.Logger = logger.WithFields(log.Fields{"component": "victorialogs-client", "source": s.Config.URL})

	return nil
}

func (s *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string]string, logger *log.Entry, uuid string) error {
	s.logger = logger
	s.Config = Configuration{}
	s.Config.Mode = configuration.CAT_MODE
	s.Config.Labels = labels
	s.Config.UniqueId = uuid

	u, err := url.Parse(dsn)
	if err != nil {
		return fmt.Errorf("while parsing dsn '%s': %w", dsn, err)
	}

	if u.Scheme != "victorialogs" {
		return fmt.Errorf("invalid DSN %s for VictoriaLogs source, must start with victorialogs://", dsn)
	}

	if u.Host == "" {
		return errors.New("empty host")
	}

	scheme := "http"

	params := u.Query()

	if q := params.Get("ssl"); q != "" {
		scheme = "https"
	}

	if q := params.Get("query"); q != "" {
		s.Config.Query = q
	}

View on GitHub (pinned to 909b515798)

Solutions

  1. Prefix the DSN with victorialogs:// — e.g. victorialogs://vl-host:9428.
  2. Do not use http:// or https://; the scheme and host/port mapping are handled by the source itself.
  3. Keep the scheme lowercase and include the '//' separator so url.Parse reports it correctly.

Example fix

// before
http://vl-host:9428

// after
victorialogs://vl-host:9428
Defensive patterns

Strategy: validation

Validate before calling

u, err := url.Parse(dsn)
if err != nil || u.Scheme != "victorialogs" || u.Host == "" {
    return fmt.Errorf("DSN must be victorialogs://host[:port], got %q", dsn)
}

Try / catch

u, err := url.Parse(dsn)
if err != nil {
    return err
}
if u.Scheme != "victorialogs" {
    log.Errorf("wrong scheme %q: use victorialogs://", u.Scheme)
    return err
}

Prevention

When it happens

Trigger: Passing a DSN like 'http://vl:9428' or 'victorialogs:host' (missing //) to ConfigureByDSN; u.Scheme check fails and this static error is returned.

Common situations: Reusing an elasticsearch/Loki datasource URL as the DSN; writing the scheme without '://' so url.Parse assigns the wrong scheme or no scheme; case issues (VictoriaLogs://) since the check is exact.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/eb9ed686240ab579. Report an issue: GitHub.