I set up several programs in supervisord. They send their output to stdout, that is forwarded to file using supervisord. There is a logrotation function in supervisord, but the problem is that it creates new file using 'root' account and my programs (that are running using user account via supervisord) fail to write there. Is it possible to set up a user, that will be used to create a new file after rotation?

  • What version of supervisord are you running? – Bratchley Jan 26 '15 at 15:57

I think you've mistaken the problem your programs have (or maybe didn't describe the question well enough)

What supervisord is doing is creating a pipe for your program to write to (stdout and maybe stderr) and then supervisord is reading that pipe and writing to the log files. In other words, the program can never fail to write to stdout due to its own permission problems. The only permission problem that could occur is if supervisord itself couldn't open the new log file.

If you just need the logs to be accessible to a specific account, you might try putting the log files in a directory with set-gid bit enabled, and make sure systemd's umask allows group-read (or write) permission.

| improve this answer | |
  • Hi, the problem is that my script is set up to run user1 account in supervisord. But when stdout log files are rotated, they are created using root. – dbf Jan 31 '15 at 18:16
  • This is fine for most people because user1 does not write to the log file; it writes to a pipe and supervisord writes to the file. If user1 account needs to be able to modify the files in the directory, then try what I suggested. chgrp -R user1 LOG_DIRECTORY; chmod g+s LOG_DIRECTORY; – dataless Feb 2 '15 at 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.