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

Kris G. Lindgren klindgren at godaddy.com
Sat Nov 7 00:00:01 UTC 2015

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 ] - - [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:
logging_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>] - - [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/172508/2/lib/neutron-legacy
Kris Lindgren
Senior Linux Systems Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20151107/8aff3546/attachment.html>

More information about the OpenStack-operators mailing list