Logging user's browser and version
Asked by Bruce Imhoff:

Is it possible to log the user's web browser and the version of that browser in Confluence when they log in to the application? I'm not very familiar with detailed configuration of logging, so I would be grateful for any help or pointers.

The purpose is to identify those users still using old browsers (IE6) and get them upgraded.


Answers:
author: Jim Birch
body: Add the AccessLogValve to the configuration

open \<app dir\>\\conf\\server.xlm

Add the Valve setting inside server/service/engine/host/context section ie after the "logger is depreciated..." comment

\<!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is specified in   
confluence/WEB-INF/classes/log4j.properties --\>  
\<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"   
prefix="access." suffix=".log" pattern="combined" resolveHosts="false"/\>

Save file and restart Confluence service

Creates access log files \<app dir\>\\logs\\access.yyyy-mm-dd.log

You need the *"combined"* pattern value to get the browser type. For less information use the value *"common"*.

Tomcat doc ref: [http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html](http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Access_Log_Valve/Attributes)

Note: This doesn't log a user id, just an ip address so you'd need to link in some othe data. Maybe the Tomcat layer doesn't know who's at the ip.

comments: author: Bruce Imhoff
body: Excellent advice, thanks. I'll try to link the IP address to the user in one of the logs, thanks!


author: David at David Simpson Apps
body: Is the purpose of this to collect usernames for your IT dept to do the upgrade? Or to alert users that their browser is out of date and therefore *they* need to upgrade their own browser?

With JavaScript, you could snoop for the browser features that are not supported and then

* Alert the user that their browser needs upgrading
* Send a background request to another service e.g. embed an image from [http://somewhere.yourcompany.com/1pixel_transparent.gif?useragent=xxx\&username=yyy](http://somewhere.yourcompany.com/1pixel_transparent.gif?useragent=xxx&username=yyy)

Having logged the image with username, you can then trawl the logs for users with outdated browsers.

Embed the JavaScript at the end of the BODY in

```
Administration | Look and Feel | Custom HTML
```


author: Raymond Lai
body: There is a hack-and-slash method.

We use Google Analytics, and we embedded the javascript inside the "Custom HTML" under the Administration \> Look and Feel section.

Advantages:

\* Google Analytics does more than record browser usage,

\* This solution only requires you to have Confluence administrative rights, and

\* You don't need to hack and slash around Apache, so your IT team doesn't even have to know. :)

comments: author: David at David Simpson Apps
body: Be sure to remember that Google Analytics does not permit you to "collect personally identifiable information". For more details, check this section from the Analytics Plugins's "Occasionally Asked Questions" page:[https://studio.plugins.atlassian.com/wiki/display/CGAP/Occasionally+Asked+Questions#OccasionallyAskedQuestions-CanGoogleAnalyticsalsotrackusernames%3F](https://studio.plugins.atlassian.com/wiki/display/CGAP/Occasionally+Asked+Questions#OccasionallyAskedQuestions-CanGoogleAnalyticsalsotrackusernames%253F)


author: Bruce Imhoff
body: Unfortunately Google Analytics won't work because we're sitting behind a firewall, but thanks for the suggestion.


author: Andrei [errno]
body: we configured Confluence / JIRA to sit behind Apache server acting as a proxy. If you use the same setup - collecting browser info is a trivial task of parsing access logs. (there are quite a few software packages that produce nice graphs (AWStats, for example)

comments: author: Bruce Imhoff
body: Thanks webwesen, we have almost the same configuration, we've got the Apache server passing internet connections through to Confluence / Jira, but also have a F5 configured for intranet connection to the same instance of Confluence and Jira, so I think we really need to configure this on the Tomcat instance that Confluence is running on, otherwise we won't collect all of the internal connections, which make up the majority of users.


Tags: analytics