/nginx-ua-parse-module

Adding user agent parsing capabilities to nginx

Primary LanguageCApache License 2.0Apache-2.0

nginx-ua-parse-module

nginx-ua-parse-module adds the ability to use BrowserScope's user agent strings to parse device, os and browser families into nginx variables.

It converts the YAML version of the regexes into json that can be replaced without re-building the module into the binary.

Idea came because we at Brow.si searched for efficient way to speed-up analytics data processing, and what's more fast than storing the logged data calcaulated? :)

Installation

$ ./configure --add-module=/path/to/nginx-ua-parse-module
$ make && make install

Generating regexes.json (requires Node.js)

$ npm install
$ node generate-regexes.js

Usage

    http {
        ...
        log_format userinfo '$remote_addr of kind $ua_parse_device_kind ($ua_parse_device running $ua_parse_os) with $ua_parse_browser';
        uaparse_list /path/to/regexes.json;
        ...
        server {
            ...
            location ... {
                ...
                access_log	logs/userinfo.log userinfo;
                ...
            }
            ...
        }
    }

Credits