Cannot redirect influxDB logs to a file in linux system using systemd

Hello,

I am running an influx 1.7.4 instance on Linux host using systemd service file and I’m trying to redirect influxdb log file to a different directory.
Service file:

-bash-4.2$ cat influxd.service
# If you modify this, please also make sure to edit init.sh

[Unit]
Description=InfluxDB is an open-source, distributed, time series database
Documentation=https://docs.influxdata.com/influxdb/
After=network-online.target

[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS 2>/tools/influxdb/logs/influxdb.log
KillMode=control-group
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=influxd.service

I added “2>/tools/influxdb/logs/influxdb.log” which should redirect all the logs to influxdb.log file according to Logging and tracing in InfluxDB | InfluxDB OSS 1.7 Documentation
However, I don’t see any log file in the directory. How can I debug or resolve this?
I’ve tried using StandardOut and StandardError too but that did not help as well.

-bash-4.2$ cat influxdb.service
# If you modify this, please also make sure to edit init.sh

[Unit]
Description=InfluxDB is an open-source, distributed, time series database
Documentation=https://docs.influxdata.com/influxdb/
After=network-online.target

[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS 2>/tools/influxdb/logs/influxdb.log
StandardOutput=/tools/influxdb/logs/influxdb-out.log
StandardError=/tools/influxdb/logs/influxdb-err.log
KillMode=control-group
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=influxd.service

Thanks!

I would also look at the log location for running it as a service since you’re using systemd. The location is stored in the env variable STDERR