[openstack-dev] [Openstack-operators] [logs] Neutron not logging user information on wsgi requests by default

Kris G. Lindgren klindgren at godaddy.com
Fri Nov 6 17:48:41 UTC 2015


Fixes to below:

logging_context_format_string is the correct config option name.

The exact link that I wanted for [1] below is actually: https://review.openstack.org/#/c/172508/2/lib/neutron-legacy

___________________________________________________________________
Kris Lindgren
Senior Linux Systems Engineer
GoDaddy

From: "Kris G. Lindgren" <klindgren at godaddy.com<mailto:klindgren at godaddy.com>>
Date: Friday, November 6, 2015 at 10:27 AM
To: "openstack-dev at lists.openstack.org<mailto:openstack-dev at lists.openstack.org>" <openstack-dev at lists.openstack.org<mailto:openstack-dev at lists.openstack.org>>
Subject: [Openstack-operators] [logs] Neutron not logging user information on wsgi requests by default

Hello all,

I noticed the otherday that in our Openstack install (Kilo) Neutron seems to be the only project that was not logging the username/tenant information on every wsgi request.  Nova/Glance/heat all log a username and/or project on each request.  Our wsgi logs from neutron look like the following:

2015-11-05 13:45:24.302 14549 INFO neutron.wsgi [req-ab633261-da6d-4ac7-8a35-5d321a8b4a8f ] 10.224.48.132 - - [05/Nov/2015 13:45:24]
"GET /v2.0/networks.json?id=2d5fe344-4e98-4ccc-8c91-b8064d17c64c HTTP/1.1" 200 655 0.027550

I did a fair amount of digging and it seems that devstack is by default overriding the context log format for neutron to add the username/tenant information into the logs.  However, there is active work to remove this override from devstack[1].  However, using the devstack way I was able to true up our neutron wsgi logs to be inline with what other services are providing.

If you add:
loggin_context_format_string = %(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s

To the [DEFAULT] section of neutron.conf and restart neutron-server.  You will now get log output like the following:

 2015-11-05 18:07:31.033 INFO neutron.wsgi [req-ebf1d3c9-b556-48a7-b1fa-475dd9df0bf7 <redacted username> <redacted tenant>] 10.224.48.132 - - [05/Nov/2015 18:07:31]
"GET /v2.0/networks.json?id=55e1b92a-a2a3-4d64-a2d8-4b0bee46f3bf HTTP/1.1" 200 617 0.035515

So go forth, check your logs, and before you need to use your logs to debug who did what,when, and where.  Get the information that you need added to the wsgi logs.  if you are not seeing wsgi logs for your projects trying enabling verbose=true in the [DEFAULT] section as well.

Adding [logs] tag since it would be nice to have all projects logging to a standard wsgi format out of the gate.

[1] - https://review.openstack.org/#/c/172510/2
___________________________________________________________________
Kris Lindgren
Senior Linux Systems Engineer
GoDaddy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20151106/0518a55b/attachment-0001.html>


More information about the OpenStack-dev mailing list