Andre's Blog
Perfection is when there is nothing left to take away
Mangling user agents is a good thing!

User agent strings come in all shapes and sizes and showing full user agent strings in reports results in too much fragmentation, as every little detail, such as a service pack or a minor version change results in a new user agent string in the report.

MangleAgents is a configuration parameter that has been around for a while and is designed, despite its name, to tidy up user agent strings and leave only those parts of the user agent string that are interesting from the analysis point of view.

Unfortunately, the original parser relied too much on the format of user agent strings available at the time when The Webalizer was written and many modern user agents were literally mangled, sometimes beyond recognition.

For example, these strings are produced at level 1. As you can see, the same user agent is reported for different versions of Microsoft's Common Language Runtime (CLR) and some mysterious numbers:

MSIE 7.0 (.NET CLR 2.0.50727)
MSIE 7.0 (.NET CLR 1.1.4322)
MSIE 6.0 (SV1)
) ()
MSIE 6.0 (.NET CLR 1.1.4322)

The new user agent parser automatically removes most well-known service pack and version identifiers and renames Windows version numbers into more familiar names, such as Windows XP or Windows Server 2003. Here is an example of user agent strings mangled at level 3:

MSIE 7.0; Windows XP
MSIE 6.0; Windows XP
MSIE 7.0; Windows Server 2003
Windows XP; en-US; Firefox/2
Windows XP; de; Firefox/2
Windows XP; en-US; Firefox/3

There are four levels the new parser understands. Detailed description of each level is provided in the README file. The new parser can be turned off by setting UseClassicMangleAgents to yes.

You will notice, however, that Internet Explorer's versions are not processed as versions. This is because Microsoft chose not to follow the HTTP specification. See this post for details: What exactly is Internet Explorer compatible with? A work-around for this deficiency will be provided in future releases of Stone Steps Webalizer.

You can also disable the predefined user agent mangler by setting MangleAgents to zero and define your own filters using ExcludeAgentArgs and IncludeAgentArgs configuration parameters, as well as to rename and group user agent arguments using GroupAgentArgs. For example, the following will instruct Stone Steps Webalizer to rename the argument Windows NT 5.1 to Windows XP:

GroupAgentArgs   Windows NT 5.1  Windows XP

Note that you need to set EnablePhraseValues to yes and use a tab character to separate the source string and the replacement in the configuration file.