crowdsecurity/crowdsec · error

only one 'log_level' parameters is required, not many

Error message

only one 'log_level' parameters is required, not many

What it means

DSN validation in the docker datasource's ConfigureByDSN: the log_level query parameter appears more than once in the docker:// DSN. url.ParseQuery groups repeated keys into a multi-element slice and the guard demands exactly one value.

Source

Thrown at pkg/acquisition/modules/docker/config.go:248

	}

	containerNameOrID := parsedURL.Host

	if containerNameOrID == "" {
		return fmt.Errorf("empty %s DSN", d.GetName()+"://")
	}

	d.Config.ContainerName = append(d.Config.ContainerName, containerNameOrID)
	// we add it as an ID also so user can provide docker name or docker ID
	d.Config.ContainerID = append(d.Config.ContainerID, containerNameOrID)

	parameters := parsedURL.Query()

	for k, v := range parameters {
		switch k {
		case "log_level":
			if len(v) != 1 {
				return errors.New("only one 'log_level' parameters is required, not many")
			}
			lvl, err := log.ParseLevel(v[0])
			if err != nil {
				return fmt.Errorf("unknown level %s: %w", v[0], err)
			}
			d.logger.Logger.SetLevel(lvl)
		case "until":
			if len(v) != 1 {
				return errors.New("only one 'until' parameters is required, not many")
			}
			d.containerLogsOptions.Until = v[0]
		case "since":
			if len(v) != 1 {
				return errors.New("only one 'since' parameters is required, not many")
			}
			d.containerLogsOptions.Since = v[0]
		case "follow_stdout":
			if len(v) != 1 {

View on GitHub (pinned to 909b515798)

Solutions

  1. Specify log_level at most once, e.g. docker://mycontainer?log_level=debug
  2. Generate DSNs programmatically with url.Values.Set to avoid duplicate keys
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/acquisition/modules/docker/config.go:248 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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