Nick M
Nick M

Reputation: 2532

Systemd: can't seem to get sidekiq to log to a file

I am trying to do something very simple: start up sidekiq with systemd on boot. Yet I am having problems with logging - it just won't log to the files I want it to, all its logging goes to /var/log/messages for some reason.

My .service file is as follows:

# /etc/systemd/system/sidekiq.service
[Unit]
Description=sidekiq
After=network.target

[Service]
Type=simple
WorkingDirectory=/app/site
ExecStart=/bin/bash -lc 'bundle exec sidekiq -e production -C config/sidekiq.yml'
User=root
Group=root

# if we crash, restart
RestartSec=1
#Restart=on-failure
Restart=always

StandardOutput=append:/app/site/log/sidekiq.out.log
StandardError=append:/app/site/log/sidekiq.err.log

[Install]
WantedBy=httpd.target

I know there are a ton of answers explaining in great detail how to get sidekiq working with systemd and how to set up logging to file for services, I have seen all of them in the last hours and apparently still missing something.

selinux is off, directory is writable, log files are 777, daemon reloaded, sidekiq is running, no other errors showing up anywhere

Am I doing something wrong that prevents me from accomplishing this very simple task?

Upvotes: 2

Views: 1787

Answers (1)

Mike Perham
Mike Perham

Reputation: 22208

You are likely running an old version of systemd that doesn't support that style of log configuration. You need v236+.

https://stackoverflow.com/a/48052152/1494519

Upvotes: 2

Related Questions