FAQ: Tracking Sessions with Usernames instead of IPs

Sawmill shows IP addresses, or hostnames, in the Sessions reports, but I want it to show usernames instead. How can I do that?

Short Answer

Detach the "Sessions" snapon (detach the "Bounce Rate (package)" snapon first if it's attached), and reattach the Sessions snapon, selecting the username field as the session user field. See the Long Answer for more options.

Long Answer

Sawmill implements session reporting using a snapon. This snapon is typically attached automatically by the log format plug-in for the log format you're analyzing, and often uses the source IP field to identify different users. If there is an actual username field, you may want to use it instead of the IP address. This is possible.

One option is to detach the Sessions snapon, in Config > Sessions (if the "Bounce Rate (package)" snapon is attached, you should detach that first, since it uses session fields), and reattach it with the new parameter (choosing the username field for the Session User). Then reattach "Bounce Rate (package)" if you detached it, and if you want bounce reporting.

Another option is to edit the plug-in for your log format, which is in LogAnalysisInfo/log_formats in your Sawmill installation, with a text editor. In there, if there is a sessions_visitor_id_field line, you can change that line to use the internal field name of the username field, e.g. 'sessions_visitor_id_field = "user"'. Then, evey profile you create from then on, using that log format plug-in, will use the "user" field as the Session User field. If there is no "sessions_visitor_id_field" line (only old plug-ins use that method), look to see if there is a "sessions" snapon in the snapons section of the file; if so, changing the session_user_field.parameter_value to the internal name of your user field, will have the same effect (all future profiles will use the "user" field as the session user). If neither is present, you may be using the Web Server Package snapon in your plug-in, which automatically attaches the Sessions snapon; it is theoretically possible to change this to use the user field as well, but it has complicated ramifications; contact Technical Support if you need this.

Finally, you can just edit the appropriate section of the profile directly, changing the components which were installed by the Sessions snapon. For instance, the Database Filters contain a Salang expression which refers to the IP address field ("hostname" or "c_ip", etc.); changing the references there to use the user field instead, will change the session analysis of that single profile, to use users. There are several reports (Session Overview, Session Paths, and other sessions reports), which will also need to be edited, to change their session fields to use the user field as the Session User.