[owncloud-devel] Log authenticated user

Josef Meile jmeile at hotmail.com
Wed Sep 16 14:13:41 GMT 2015



In the apache logs I always see things like:

xxx.xxx.xxx.xxx - - [16/Sep/2015:15:13:05 +0200] "POST /index.php/heartbeat
HTTP/1.1" 200 -


If you see, just after the IP, it comes two dashes with an space in between:
"- -".


I have seen this in other applications and I could solved it by setting an
http header, I defined this custom log type:

LogFormat "%h - %{X-OCUser}o %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-Agent}i\"" ownCloud


Then you can use it for your apache logs as follows:

CustomLog logs/access_log ownCloud


I think the best would be before rendering an ownCloud and just after the
user gets authenticated. Something like this should be added:

$request->setHeader('X-OCUser', currentUser);


Where can I set this?


Best regards


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.owncloud.org/pipermail/devel/attachments/20150916/fa8d020d/attachment.html>

More information about the Devel mailing list