configure json logging for uwsgi in k8s environments
This commit is contained in:
@@ -10,9 +10,20 @@ events {
|
||||
|
||||
http {
|
||||
default_type application/octet-stream;
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
log_format json escape=json
|
||||
'{'
|
||||
'"timestamp":"$time_iso8601",'
|
||||
'"msec":"$msec",'
|
||||
'"request_id":"$request_id",'
|
||||
'"remote_addr":"$remote_addr",'
|
||||
'"remote_user":"$remote_user",'
|
||||
'"request":"$request",'
|
||||
'"status":$status,'
|
||||
'"body_bytes_sent":$body_bytes_sent,'
|
||||
'"referer":"$http_referer",'
|
||||
'"user_agent":"$http_user_agent",'
|
||||
'"http_x_forwarded_for":"$http_x_forwarded_for"'
|
||||
'}';
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
@@ -20,7 +31,7 @@ http {
|
||||
listen 8000;
|
||||
server_name localhost;
|
||||
|
||||
access_log /dev/stdout;
|
||||
access_log /dev/stdout json;
|
||||
|
||||
location / {
|
||||
try_files $uri @app;
|
||||
|
@@ -3,6 +3,7 @@
|
||||
callable = app
|
||||
module = app
|
||||
plugin = python3
|
||||
plugin = stdio
|
||||
socket = localhost:8080
|
||||
|
||||
; logger config
|
||||
|
Reference in New Issue
Block a user