crowdsecurity/crowdsec · error
unsupported key %s in journalctl DSN
Error message
unsupported key %s in journalctl DSN
What it means
The journalctl DSN query string only accepts the keys 'filters' and 'since' (plus log_level handling). Any other key present in the parsed query produces this error, since strict DSN parsing prevents silently ignored configuration.
Source
Thrown at pkg/acquisition/modules/journalctl/config.go:121
case "log_level":
if len(value) != 1 {
return errors.New("expected exactly one value for 'log_level'")
}
lvl, err := log.ParseLevel(value[0])
if err != nil {
return err
}
logLevel = lvl
case "since":
if len(value) != 1 {
return errors.New("expected exactly one value for 'since'")
}
since = value[0]
default:
return fmt.Errorf("unsupported key %s in journalctl DSN", key)
}
}
s.config = Configuration{
DataSourceCommonCfg: configuration.DataSourceCommonCfg{
Mode: configuration.CAT_MODE,
Labels: labels,
UniqueId: uuid,
},
Filters: filters,
since: since,
}
s.setSrc(s.config.Filters)
s.setLogger(logger, logLevel, s.src)
return nil
}View on GitHub (pinned to 909b515798)
Solutions
- Replace the unsupported key with a supported one: 'filters' (repeatable) or 'since'.
- Express journalctl flags as filter matches, e.g. --unit=sshd becomes filters=_SYSTEMD_UNIT=sshd.service.
- Set verbosity via the source's log_level config in YAML, not a DSN key, unless the documented key list allows it.
- Check the journalctl acquisition docs for the exact supported DSN parameter list.
Example fix
// before
s.ConfigureByDSN("journalctl://unit=sshd.service")
// after
s.ConfigureByDSN("journalctl://filters=_SYSTEMD_UNIT=sshd.service") Defensive patterns
Strategy: validation
Validate before calling
params, err := url.ParseQuery(strings.TrimPrefix(dsn, "journalctl://"))
if err != nil { return err }
for k := range params {
switch k {
case "filters", "since":
default:
return fmt.Errorf("key %q is not supported; use filters or since", k)
}
} Try / catch
if err := src.ConfigureByDSN(dsn); err != nil {
if strings.Contains(err.Error(), "unsupported key") {
// rewrite DSN with documented keys and retry
}
} Prevention
- Only use the documented DSN keys: filters (repeatable) and since
- Translate journalctl CLI flags into journal field filters (e.g. --unit -> _SYSTEMD_UNIT)
- Keep a reference DSN example next to your acquis config
When it happens
Trigger: Calling ConfigureByDSN with e.g. 'journalctl://unit=sshd' or 'journalctl://filters=...&level=debug' — 'unit' and 'level' are unsupported key names.
Common situations: Users guessing key names from the systemd journalctl CLI flags (--unit, --level) instead of the documented DSN keys; mixing journalctl source config with journalctl command-line syntax.
Related errors
- invalid DSN %s for journalctl source, must start with journa
- cannot parse: %s
- empty journalctl:// DSN
- expected exactly one value for 'log_level'
- expected exactly one value for 'since'
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/2c7b82a1720b0290.
Report an issue: GitHub.