configure json logging for uwsgi in k8s environments

This commit is contained in:
dandds
2019-04-02 17:04:27 -04:00
parent a86751e010
commit f72ec839a9
6 changed files with 81 additions and 9 deletions

View File

@@ -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;

View File

@@ -3,6 +3,7 @@
callable = app
module = app
plugin = python3
plugin = stdio
socket = localhost:8080
; logger config