{"record":{"id":"734455c5a242535e","repo":"crowdsecurity/crowdsec","slug":"invalid-port-d","errorCode":null,"errorMessage":"invalid port %d","messagePattern":"invalid port (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/syslog/config.go","lineNumber":60,"sourceCode":"\t\tc.Mode = configuration.TAIL_MODE\n\t}\n\n\tif c.Addr == \"\" {\n\t\tc.Addr = \"127.0.0.1\" // do we want a usable or secure default ?\n\t}\n\n\tif c.Port == 0 {\n\t\tc.Port = 514\n\t}\n\n\tif c.MaxMessageLen == 0 {\n\t\tc.MaxMessageLen = 2048\n\t}\n}\n\nfunc (c *Configuration) Validate() error {\n\tif c.Port <= 0 || c.Port > 65535 {\n\t\treturn fmt.Errorf(\"invalid port %d\", c.Port)\n\t}\n\n\tif net.ParseIP(c.Addr) == nil {\n\t\treturn fmt.Errorf(\"invalid listen IP %s\", c.Addr)\n\t}\n\n\treturn nil\n}\n\nfunc (s *Source) UnmarshalConfig(yamlConfig []byte) error {\n\tcfg, err := ConfigurationFromYAML(yamlConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.config = cfg\n\n\treturn nil","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/syslog/config.go#L42-L78","documentation":"The syslog acquisition Validate() method rejects a configuration whose listen port is not in the valid TCP/UDP range 1-65535. Port 0, negative values, and values above 65535 are all invalid for binding a UDP listener. This is a fail-fast config sanity check performed when the syslog datasource is configured.","triggerScenarios":"A syslog acquisition YAML specifies a 'port' field that is 0, negative, or greater than 65535, or omits port entirely (zero value).","commonSituations":"Typo in the port number in acquis.yaml; port key left out of the syslog stanza so it defaults to 0; port pasted from another tool as a string ending up unparseable; copy-pasting a config that used a named service instead of a number.","solutions":["Set a valid 'port' value (1-65535) in the syslog acquisition config, typically 514 for syslog.","If port was omitted, add the port: key under the syslog datasource stanza.","Check for YAML indentation issues that put the port field in the wrong stanza so it is not parsed."],"exampleFix":"// before (config.yaml)\nsource: syslog\nlisten_addr: 0.0.0.0\n# port missing -> defaults to 0\n\n// after\nsource: syslog\nlisten_addr: 0.0.0.0\nport: 514","handlingStrategy":"validation","validationCode":"port := cfg.Port\nif port <= 0 || port > 65535 {\n    return fmt.Errorf(\"syslog port must be 1-65535, got %d\", port)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set an explicit port in syslog acquisition stanzas; never rely on zero-value defaults.","Validate acquisition YAML in CI before deployment.","Keep port as a quoted or plain integer consistently in YAML."],"tags":["config","network","syslog","validation"],"backgroundTag":"invalid-config-value","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"}