owasp-amass/amass · error
no syslog host specified
Error message
no syslog host specified
What it means
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.
Source
Thrown at internal/tools/log.go:61
return nil, fmt.Errorf("failed to create the log directory: %v", err)
}
}
f, err := os.OpenFile(filepath.Join(dir, logfile), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return nil, fmt.Errorf("failed to open the log file: %v", err)
}
return slog.New(slog.NewJSONHandler(f, nil)), nil
}
func NewSyslogLogger() (*slog.Logger, error) {
port := os.Getenv("SYSLOG_PORT")
host := strings.ToLower(os.Getenv("SYSLOG_HOST"))
transport := strings.ToLower(os.Getenv("SYSLOG_TRANSPORT"))
if host == "" {
return nil, fmt.Errorf("no syslog host specified")
}
if port == "" {
port = "514"
}
if transport == "" {
transport = "udp"
}
writer, err := net.Dial(transport, net.JoinHostPort(host, port))
if err != nil {
return nil, fmt.Errorf("failed to create the connection to the log server: %v", err)
}
return slog.New(slogsyslog.Option{
Level: slog.LevelInfo,
Converter: syslogConverter,
Writer: writer,
}.NewSyslogHandler()), nilView on GitHub (pinned to 79299dce87)
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
Example fix
// before
cmd.Env = []string{"PATH=/usr/bin"} // SYSLOG_HOST missing
// after
cmd.Env = append(os.Environ(), "SYSLOG_HOST=syslog.example.com", "SYSLOG_PORT=514") Defensive patterns
Strategy: validation
Validate before calling
host := os.Getenv("SYSLOG_HOST")
if host == "" {
return errors.New("SYSLOG_HOST must be set when syslog logging is selected")
} Try / catch
logger, err := tools.NewSyslogLogger()
if err != nil {
if strings.Contains(err.Error(), "no syslog host specified") {
log.Warn("SYSLOG_HOST unset; falling back to file logging")
logger, err = tools.NewFileLogger(dir, logfile)
}
if err != nil { return err }
} Prevention
- 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)
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- logger handler is not enabled
- no log file specified
- failed to create the log directory: %v
- failed to open the log file: %v
- failed to create the connection to the log server: %v
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/d7415d2f2e4d568d.
Report an issue: GitHub.