Syslog-ng fails when started with systemd

Hi,

I just installed syslog-ng from the repository. When I start it using systemd, I get the following error:

(syslog-ng)[32135]: syslog-ng@service.service: Referenced but unset environment variable evaluates to an empty string: CONFIG_FILE, CONTROL_FILE, OTHER_OPTIONS, PERSIST_FILE, PID_FILE

The systemd service file at /usr/lib/systemd/system/syslog-ng@.service reads:

[Unit]
Description=System Logger Daemon "%i" instance
Documentation=man:syslog-ng(8)
Conflicts=emergency.service emergency.target
Wants=network.target network-online.target
After=network.target network-online.target

[Service]
Type=notify
EnvironmentFile=-/etc/default/syslog-ng@%i
ExecStart=/usr/bin/syslog-ng -F $OTHER_OPTIONS --cfgfile $CONFIG_FILE --control $CONTROL_FILE --persist-file $PERSIST_FILE --pidfile $PID_FILE
ExecReload=/usr/bin/kill -HUP $MAINPID
StandardOutput=journal
StandardError=journal
Restart=on-failure

[Install]
DefaultInstance=default
WantedBy=multi-user.target

and the environment file at /etc/default/syslog-ng@default reads:

CONFIG_FILE=/etc/syslog-ng/syslog-ng.conf
PERSIST_FILE=/var/lib/syslog-ng/syslog-ng.persist
CONTROL_FILE=/run/syslog-ng.ctl
PID_FILE=/run/syslog-ng.pid
OTHER_OPTIONS="--enable-core"

Here is the output of syslog-ng -V:

syslog-ng 4 (4.10.2.dirty)
Config version: 4.2
Installer-Version: 4.10.2.dirty
Revision: 
Compile-Date: Jan  5 2026 21:56:43
Module-Directory: /usr/lib/syslog-ng
Module-Path: /usr/lib/syslog-ng
Include-Path: /usr/share/syslog-ng/include
Available-Modules: add-contextual-data,affile,afprog,afsocket,afstomp,afuser,appmodel,azure-auth-header,basicfuncs,bigquery,cef,clickhouse,cloud_auth,confgen,correlation,cryptofuncs,csvparser,disk-buffer,examples,graphite,hook-commands,http,json-plugin,kvformat,linux-kmsg-format,loki,map-value-pairs,metrics-probe,otel,pseudofile,pubsub,rate-limit-filter,regexp-parser,sdjournal,secure-logging,stardate,syslogformat,system-source,tags-parser,tfgetent,timestamp,xml
Enable-Debug: off
Enable-GProf: off
Enable-Memtrace: off
Enable-Stackdump: off
Enable-IPv6: on
Enable-Spoof-Source: on
Enable-TCP-Wrapper: off
Enable-Linux-Caps: on
Enable-Systemd: on

If I start syslog-ng from the command line it works fine. This is the only systemd service I am having problems with.

Any hints would be greatly appreciated. Thanks

Which command did you used to enable and start the service?

You can run multiple syslog-ng instances with different configurations. If you want to use the “default” config, you need to enable and start syslog-ng@default.service

For example

systemctl enable --now syslog-ng@default.service

See also

Thanks, xabbu! That was the problem.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.