1

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?

1
  • What version of supervisord are you running?
    – Bratchley
    Commented Jan 26, 2015 at 15:57

1 Answer 1

1

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.

2
  • 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
    Commented Jan 31, 2015 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
    Commented Feb 2, 2015 at 5:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .