hashicorp/nomad · error
journald log monitoring only available on linux
Error message
journald log monitoring only available on linux
What it means
NewExportMonitor in command/agent/monitor/export_monitor.go only supports journald-based log monitoring on Linux. If opts.ServiceName is non-empty (requesting journald log export) while runtime.GOOS is not linux, construction fails with this error. journald is a systemd/Linux facility so there is no implementation on other OSes.
Source
Thrown at command/agent/monitor/export_monitor.go:86
type ExportReader struct {
io.Reader
Cmd *exec.Cmd
UseCli bool
Follow bool
}
// NewExportMonitor validates and prepares the appropriate reader before
// returning a new ExportMonitor or the appropriate error
func NewExportMonitor(opts MonitorExportOpts) (*ExportMonitor, error) {
var (
exportReader *ExportReader
bufSize int
)
if runtime.GOOS != "linux" &&
opts.ServiceName != "" {
return nil, errors.New("journald log monitoring only available on linux")
}
if opts.BufSize == 0 {
bufSize = defaultBufSize
} else {
bufSize = opts.BufSize
}
if opts.OnDisk && opts.ServiceName == "" {
e, prepErr := fileReader(opts)
if prepErr != nil {
return nil, prepErr
}
exportReader = e
}
if opts.ServiceName != "" && !opts.OnDisk {
e, prepErr := cliReader(opts)View on GitHub (pinned to 482b49bf1a)
Solutions
- Run the command on a Linux host with systemd/journald where the service actually exists.
- Remove the ServiceName option (or clear it) when monitoring is not needed on non-Linux platforms so journald monitoring is not requested.
- Set the journald service name only via config applied to Linux clients, e.g. gate the config block by platform.
- If on Linux this still fires, verify the build/runtime — it means runtime.GOOS reports non-linux, which should not occur on a standard Linux build.
Example fix
// before (on macOS)
NewExportMonitor(ExportMonitorOptions{ServiceName: "nomad-client.service", ...})
// after
if runtime.GOOS != "linux" {
// drop journald option
NewExportMonitor(ExportMonitorOptions{BufSize: 4096})
} Defensive patterns
Strategy: validation
Validate before calling
if runtime.GOOS != "linux" && serviceName != "" {
// skip or error before calling NewExportMonitor
return errors.New("journald export requires linux; drop ServiceName or run on linux")
} Try / catch
m, err := monitor.NewExportMonitor(opts)
if err != nil {
if strings.Contains(err.Error(), "only available on linux") {
log.Warn("journald monitoring unavailable on this OS; continuing without it")
return nil
}
return err
} Prevention
- Only set ServiceName in configs deployed to Linux/systemd hosts.
- Gate journald monitoring config by OS in provisioning tooling.
- Run remote-monitoring commands on the Linux server, not a macOS workstation.
When it happens
Trigger: Requesting an export monitor with a ServiceName set (journald monitoring) on a Nomad agent/CLI running on darwin (macOS) or windows — e.g. running `nomad monitor`-style export with a systemd service name from a Mac.
Common situations: Developers running Nomad on macOS/Windows workstations issuing commands configured for a Linux server; copy-pasted config referencing journald service names on non-systemd hosts; CI runners on non-Linux OS.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- -dev-connect is only supported on linux.
- service name too long
- service name must include 'nomad
- invalid suffix
- oom_score_adj must not be negative
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/cf853a8b7c636d18.
Report an issue: GitHub.