camptocamp/odoo-cloud-platform

[logging_json / monitoring_log_requests] monitoring.http.requests message logged as escaped string, not JSON

dannyadair opened this issue · 2 comments

When I run both logging_json and monitoring_log_requests, the output of the latter comes out as an escaped string, rather than nested JSON (and thus parsed as a string by logstash):

odooapp        | {"asctime": "2021-08-30 00:35:49,662", "pid": 1, "levelname": "INFO", "dbname": "DannyDEV", "name": "monitoring.http.requests", "message": "{\"start_time\": \"2021-08-30 00:35:49\", \"duration\": 0.008325576782226562, \"method\": \"POST\", \"url\": \"http://localhost:8069/web/dataset/call_kw/res.users/review_user_count\", \"status_code\": 200, \"headers\": {\"wsgi.version\": [1, 0], \"wsgi.url_scheme\": \"http\", \"wsgi.input\": \"<non-serializable: BufferedReader>\", \"wsgi.errors\": \"<non-serializable: TextIOWrapper>\", \"wsgi.multithread\": true, \"wsgi.multiprocess\": false, \"wsgi.run_once\": false, \"werkzeug.server.shutdown\": \"<non-serializable: function>\", \"SERVER_SOFTWARE\": \"Werkzeug/0.16.1\", \"REQUEST_METHOD\": \"POST\", \"SCRIPT_NAME\": \"\", \"PATH_INFO\": \"/web/dataset/call_kw/res.users/review_user_count\", \"QUERY_STRING\": \"\", \"REQUEST_URI\": \"/web/dataset/call_kw/res.users/review_user_count\", \"RAW_URI\": \"/web/dataset/call_kw/res.users/review_user_count\", \"REMOTE_ADDR\": \"172.26.0.1\", \"REMOTE_PORT\": 51594, \"SERVER_NAME\": \"0.0.0.0\", \"SERVER_PORT\": \"8069\", \"SERVER_PROTOCOL\": \"HTTP/1.1\", \"HTTP_HOST\": \"localhost:8069\", \"HTTP_CONNECTION\": \"keep-alive\", \"CONTENT_LENGTH\": \"219\", \"HTTP_ACCEPT\": \"application/json, text/javascript, */*; q=0.01\", \"HTTP_X_REQUESTED_WITH\": \"XMLHttpRequest\", \"HTTP_USER_AGENT\": \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36\", \"CONTENT_TYPE\": \"application/json\", \"HTTP_SEC_GPC\": \"1\", \"HTTP_ORIGIN\": \"http://localhost:8069\", \"HTTP_SEC_FETCH_SITE\": \"same-origin\", \"HTTP_SEC_FETCH_MODE\": \"cors\", \"HTTP_SEC_FETCH_DEST\": \"empty\", \"HTTP_REFERER\": \"http://localhost:8069/web\", \"HTTP_ACCEPT_ENCODING\": \"gzip, deflate, br\", \"HTTP_ACCEPT_LANGUAGE\": \"en\", \"HTTP_DNT\": \"1\", \"werkzeug.request\": \"<non-serializable: Request>\"}, \"uid\": 2, \"server_environment\": \"test\", \"session\": {\"db\": \"DannyDEV\", \"uid\": 2, \"login\": \"admin\", \"context\": {\"lang\": \"en_GB\", \"tz\": \"Pacific/Auckland\", \"uid\": 2}, \"debug\": \"assets\", \"geoip\": {}}, \"params\": {\"args\": [], \"model\": \"res.users\", \"method\": \"review_user_count\", \"kwargs\": {}}}", "perf_info": "", "request_id": "9e83f62b-de18-4e7d-bd74-d49cfe3d5257", "uid": 2}
odooapp        | {"asctime": "2021-08-30 00:35:49,673", "pid": 1, "levelname": "INFO", "dbname": "DannyDEV", "name": "werkzeug", "message": "172.26.0.1 - - [30/Aug/2021 00:35:49] \"POST /web/dataset/call_kw/res.users/review_user_count HTTP/1.1\" 200 -", "perf_info": "2 0.002 0.025", "request_id": "9e83f62b-de18-4e7d-bd74-d49cfe3d5257", "uid": 2}

❯ grep LOG_HANDLER odooapp/odoo.conf
LOG_HANDLER=":WARNING,monitoring.http.requests:INFO"
❯ 

This can't be expected behaviour - what am I doing wrong?

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.