Google StackDrive logging level in containers with uwsgi is always at error level

I deploy via Kuberenetes containers come to Google Cloud, which are a django and uwsgi project to run them.

I am using the stackdrive logger to see the logging, the problem is that all entries are treated as ERROR

severity even though they are not an error. It seems that the log is being uwsgi

written to stderr

or something.

In the picture you can see that django is using the level INFO

, but it is received as ERROR

in the stackdrive.

enter image description here

This is how I set up UWSGI.

[uwsgi] master = true socket = :3031 chdir =. wsgi-file = docker.wsgi processes = 4 threads = 2 socket-timeout = 90 harakiri = 90 http = :8000 env = prometheus_multiproc_dir=multi enable-threads = yes lazy-apps = yes pidfile=/tmp/project-master.pid

+6


source to share


2 answers


Kubernetes logs written to stderr

are always marked as ERROR - this is hardcoded in the Stackdriver log agent. Likewise, logs written to stdout

are always marked INFO.



If you can configure your application to write error-free error log messages to stdout

, do so. Another possible approach is to write the logs to a file, run the command " tail -f

" on that file as a sidecar container in the same container, and search for your logs in the Stackdriver Logs Viewer in the sidecar container. Finally, you might consider writing your logs directly to the Stackdriver Logging API , which gives you complete control over the content of each record.

+4


source


This answer helped me find a solution to this problem. Using the logger-req=stdio

uWSGI option, the logs get the correct level in the Stackdriver.

Example uwsgi.ini

:



[uwsgi]
logger-req=stdio

      

0


source







All Articles