3

I am running a Python Flask server on uWSGI over an EC2 Ubuntu 14.04 LTS. The server is configured as follows:

[uwsgi]
http-socket    = :9000
plugin         = python
wsgi-file      = /path/to_wsgi.py
enable-threads = true

The logs, however, are created using root permissions without read access:

$ ls -ltrh /var/log/uwsgi/app
total 34M
-rw-r----- 1 root root 2.3M Jun  4 06:50 reporter-uwsgi.log.2.gz
-rw-r----- 1 root root  24M Jun  5 06:51 reporter-uwsgi.log.1
-rw-r----- 1 root root 8.4M Jun  5 17:27 reporter-uwsgi.log

This is an annoyance, because some of my scripts run as a normal user and parse these logs.

Any idea how to configure uWSGI to be written with global read permissions?

4

You can use the logfile-chown and logfile-chmod configuration options. Both can be set from the command line or in an .ini file.

Here is an example:

[uwsgi]
# ...
logto = /path/file_name.log
logfile-chown = username:groupname
logfile-chmod = 640

More information in the documentation.

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.