大网数据广告活动
服务器运维问答

Python uWSGI logs have no read permissions

· 52CE 我爱测

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 …

问题原文

原帖链接 · Adam Matan · CC BY-SA 3.0

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?

已采纳解答

原帖链接 · nicolov · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-06-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。