Stone Steps Inc.

Article ID: Q20051003-01

Q: Is it possible to group user agents using patterns with embedded spaces?

A:When processing two-part configuration entries, such as GroupAgent, Stone Steps Webalizer looks for a space or a tab character in order to separate the value and the name of the name/value pair. For example, the following GroupAgent entry will instruct Stone Steps Webalizer to look for a substring MSIE in the user agent field of a current log record and, if found, to create a group named Internet Explorer.

GroupAgent    MSIE      Internet Explorer

Consequently, because the space character is treated as a name/value separator, group values cannot contain embedded spaces. As of v2.1.20.22, a new configuration parameter (EnablePhraseValues) has been introduced that can be used to configure Stone Steps Webalizer to treat the tab character as a name/value separator and ignore space characters embedded in values.

If EnablePhraseValues is set to yes, Stone Steps Webalizer will extract the value of a two-part entry as a sequence of characters, including embedded spaces, up to the first tab character. The value and the name are trimmed, so that neither of them contains leading or trailing spaces (the arrow depicts a tab):

GroupAgent    Mozilla/4.0 (compatible; MSIE 6* → Internet Explorer v6
              ^----------- value ------------^   ^------ name ------^

Multiple tab characters may be used to separate the value and the name, if required.

Please, note that if EnablePhraseValues is set to yes, but there is no at least one tab character separating the value from the name, the rest of the line following the keyword will be treated as value text. In this case, the associated functionality will not work as expected.

It is also important to understand that all two-part configuration entries are affected by this setting, not just GroupAgent.