{"record":{"id":"28df20e9ca23bb28","repo":"owasp-amass/amass","slug":"failed-to-create-the-connection-to-the-log-server","errorCode":null,"errorMessage":"failed to create the connection to the log server: %v","messagePattern":"failed to create the connection to the log server: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/log.go","lineNumber":72,"sourceCode":"\nfunc NewSyslogLogger() (*slog.Logger, error) {\n\tport := os.Getenv(\"SYSLOG_PORT\")\n\thost := strings.ToLower(os.Getenv(\"SYSLOG_HOST\"))\n\ttransport := strings.ToLower(os.Getenv(\"SYSLOG_TRANSPORT\"))\n\n\tif host == \"\" {\n\t\treturn nil, fmt.Errorf(\"no syslog host specified\")\n\t}\n\tif port == \"\" {\n\t\tport = \"514\"\n\t}\n\tif transport == \"\" {\n\t\ttransport = \"udp\"\n\t}\n\n\twriter, err := net.Dial(transport, net.JoinHostPort(host, port))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create the connection to the log server: %v\", err)\n\t}\n\n\treturn slog.New(slogsyslog.Option{\n\t\tLevel:     slog.LevelInfo,\n\t\tConverter: syslogConverter,\n\t\tWriter:    writer,\n\t}.NewSyslogHandler()), nil\n}\n\nfunc syslogConverter(addSource bool, replaceAttr func(groups []string, a slog.Attr) slog.Attr, loggerAttr []slog.Attr, groups []string, record *slog.Record) map[string]any {\n\tattrs := slogcommon.AppendRecordAttrsToAttrs(loggerAttr, groups, record)\n\tattrs = slogcommon.ReplaceAttrs(replaceAttr, []string{}, attrs...)\n\n\treturn map[string]any{\n\t\t\"level\":   record.Level.String(),\n\t\t\"message\": record.Message,\n\t\t\"attrs\":   slogcommon.AttrsToMap(attrs...),\n\t}","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/internal/tools/log.go#L54-L90","documentation":"NewSyslogLogger dials the syslog server with net.Dial(transport, host:port) using SYSLOG_TRANSPORT (default udp, port 514). This error wraps any dial failure — DNS resolution failure, connection refused/timeout, or an unsupported transport string.","triggerScenarios":"SYSLOG_HOST does not resolve or is unreachable; the syslog daemon is down or not listening on the chosen port; transport set to tcp but the server only accepts udp (or an invalid value like \"tls\" that net.Dial does not recognize); network policy/firewall dropping port 514.","commonSituations":"Typo in the hostname, rsyslog/syslog-ng container not started, Kubernetes NetworkPolicy blocking egress, specifying \"tls\" instead of \"tcp\" (net.Dial has no \"tls\" network), or an IPv6-only host with a v4-only resolver.","solutions":["Confirm the server is reachable: `nc -zvu <host> 514` (udp) or `nc -zv <host> 514` (tcp), and DNS resolves correctly","Set SYSLOG_TRANSPORT to a net.Dial-supported network: \"udp\", \"tcp\", \"udp4\", \"tcp4\", etc. — use \"tcp\" if you meant TLS-secured syslog via a local relay","Check firewall/NetworkPolicy rules and start the syslog daemon (systemctl start rsyslog or the container)","Verify host/port env values (SYSLOG_HOST, SYSLOG_PORT) are correct and the port matches the daemon's config"],"exampleFix":"// before\nexport SYSLOG_TRANSPORT=tls   # net.Dial has no \"tls\" network\n// after\nexport SYSLOG_TRANSPORT=udp   # or run a local TLS relay on tcp\nexport SYSLOG_HOST=10.0.0.5\nexport SYSLOG_PORT=514","handlingStrategy":"retry","validationCode":"host := os.Getenv(\"SYSLOG_HOST\")\ntransport := os.Getenv(\"SYSLOG_TRANSPORT\")\nif transport == \"\" { transport = \"udp\" }\nvalid := map[string]bool{\"udp\": true, \"udp4\": true, \"udp6\": true, \"tcp\": true, \"tcp4\": true, \"tcp6\": true}\nif !valid[transport] {\n\treturn fmt.Errorf(\"SYSLOG_TRANSPORT %q is not a net.Dial network\", transport)\n}\nif _, err := net.LookupHost(host); err != nil {\n\treturn fmt.Errorf(\"SYSLOG_HOST %q does not resolve: %v\", host, err)\n}","typeGuard":null,"tryCatchPattern":"logger, err := tools.NewSyslogLogger()\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to create the connection\") {\n\t\ttime.Sleep(2 * time.Second) // transient network? retry once\n\t\tlogger, err = tools.NewSyslogLogger()\n\t}\n\tif err != nil {\n\t\tlog.Warn(\"syslog unreachable; falling back to file logging\")\n\t\tlogger, err = tools.NewFileLogger(dir, logfile)\n\t\tif err != nil { return err }\n\t}\n}","preventionTips":["Validate SYSLOG_TRANSPORT is one of udp/tcp/udp4/udp6/tcp4/tcp6 — never \"tls\"","Test connectivity to the syslog server (nc -zvu host 514) before rollout","Open firewall/NetworkPolicy egress to the syslog port for the deployment environment","Ensure the syslog daemon is running and listening on the configured host/port"],"tags":["go","network","syslog","connection"],"backgroundTag":"connection-refused","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}