Skip to content

Commit 6568ee8

Browse files
author
Osman
committed
Add config for uwsgi log formatting
1 parent e2825c1 commit 6568ee8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/server/bin/startServer.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ echo "SLEEPING.. WAITING FOR DB"; sleep 5; echo "WAKING"; alembic upgrade head;
1111

1212
# --no-reload prevents Flask restart, which usually happens in middle of create_base_users()
1313
#TODO: SECURITY - ensure we are not running in debug mode in production
14-
uwsgi --http-socket :5000 --plugin python38 --module wsgi:app --chdir /app --pythonpath . --processes 2 --threads 4 --master
14+
UWSGI_LOG_CONFIG="bin/uwsgi_log_config.json"
15+
# Remove newlines and extra whitespace from log formatting
16+
LOG_FORMAT=$(cat $UWSGI_LOG_CONFIG | tr -d \\n | tr -s ' ')
17+
uwsgi --logformat "$LOG_FORMAT" --http-socket :5000 --plugin python38 --module wsgi:app --chdir /app --pythonpath . --processes 2 --threads 4 --master

src/server/bin/uwsgi_log_config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"host": "%(host)",
3+
"address": "%(addr)",
4+
"method": "%(method)",
5+
"protocol": "%(proto)",
6+
"resp_size": "%(size)",
7+
"request_body_size": "%(cl)",
8+
"response_status": "%(status)",
9+
"response_time": "%(secs)",
10+
"uri": "%(uri)"
11+
}

0 commit comments

Comments
 (0)