{"record":{"id":"d7415d2f2e4d568d","repo":"owasp-amass/amass","slug":"no-syslog-host-specified","errorCode":null,"errorMessage":"no syslog host specified","messagePattern":"no syslog host specified","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/log.go","lineNumber":61,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"failed to create the log directory: %v\", err)\n\t\t}\n\t}\n\n\tf, err := os.OpenFile(filepath.Join(dir, logfile), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open the log file: %v\", err)\n\t}\n\n\treturn slog.New(slog.NewJSONHandler(f, nil)), nil\n}\n\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","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/internal/tools/log.go#L43-L79","documentation":"NewSyslogLogger builds a slog logger that ships JSON records to a syslog server. It reads SYSLOG_HOST, SYSLOG_PORT, and SYSLOG_TRANSPORT from the environment. This error is returned when SYSLOG_HOST is unset or empty, since a syslog destination cannot be dialed without a host.","triggerScenarios":"Calling NewSyslogLogger when SYSLOG_HOST is not set in the environment (or set to an empty string), and the syslog logging path is selected via selectLogger.","commonSituations":"Deploying to a new container/Kubernetes pod where SYSLOG_HOST was configured only locally; selecting syslog logging in a config but never exporting the env vars; typo'd variable name (e.g. SYSLOGSERVER) or defining it only in an interactive shell but not in the service unit.","solutions":["Export SYSLOG_HOST to your syslog server, e.g. export SYSLOG_HOST=syslog.example.com","Add SYSLOG_HOST (and optionally SYSLOG_PORT, SYSLOG_TRANSPORT) to your deployment config (service unit, container env, k8s env)","Verify with `printenv SYSLOG_HOST` in the exact environment where the tool runs","Use file logging instead if no syslog server is available"],"exampleFix":"// before\ncmd.Env = []string{\"PATH=/usr/bin\"} // SYSLOG_HOST missing\n// after\ncmd.Env = append(os.Environ(), \"SYSLOG_HOST=syslog.example.com\", \"SYSLOG_PORT=514\")","handlingStrategy":"validation","validationCode":"host := os.Getenv(\"SYSLOG_HOST\")\nif host == \"\" {\n\treturn errors.New(\"SYSLOG_HOST must be set when syslog logging is selected\")\n}","typeGuard":null,"tryCatchPattern":"logger, err := tools.NewSyslogLogger()\nif err != nil {\n\tif strings.Contains(err.Error(), \"no syslog host specified\") {\n\t\tlog.Warn(\"SYSLOG_HOST unset; falling back to file logging\")\n\t\tlogger, err = tools.NewFileLogger(dir, logfile)\n\t}\n\tif err != nil { return err }\n}","preventionTips":["Document SYSLOG_HOST as required whenever the syslog logger type is selected","Add the env var to service units, container env, and k8s manifests (not just interactive shells)","Fail fast at startup with a clear message if the env var is missing","Use a secrets/config management check (e.g. `printenv SYSLOG_HOST` in health checks)"],"tags":["go","logging","syslog","environment"],"backgroundTag":"missing-env-var","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"}