<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>Hello all,</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>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]</div>
<div>"GET /v2.0/networks.json?id=2d5fe344-4e98-4ccc-8c91-b8064d17c64c HTTP/1.1" 200 655 0.027550</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>If you add: </div>
<div>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</div>
<div><br>
</div>
<div>To the [DEFAULT] section of neutron.conf and restart neutron-server. You will now get log output like the following:</div>
<div><br>
</div>
<div> 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] </div>
<div>"GET /v2.0/networks.json?id=55e1b92a-a2a3-4d64-a2d8-4b0bee46f3bf HTTP/1.1" 200 617 0.035515</div>
</div>
<div><br>
</div>
<div>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. </div>
<div><br>
</div>
<div>Adding [logs] tag since it would be nice to have all projects logging to a standard wsgi format out of the gate.</div>
<div><br>
</div>
<div>[1] - https://review.openstack.org/#/c/172510/2</div>
<div>
<div id="">
<div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Calibri">___________________________________________________________________</font></font></div>
<div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Calibri">Kris Lindgren</font></font></div>
<div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Calibri"><span class="Apple-style-span" style="font-size: 14px;">Senior Linux Systems Engineer</span></font></font></div>
<div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Calibri"><span class="Apple-style-span" style="font-size: 14px;">GoDaddy</span></font></font></div>
</div>
</div>
</body>
</html>