logstash/logstash — pull request #347 by deverton (2013-02-04 23:51:16+00:00)
Title: Add HTTP User-Agent Parsing Filter

Adds a filter that can parse a user agent string in to structured data. This can be used for real-time analytics or other analysis. The parsing is based on the BrowserScope regexes YAML file from https://github.com/tobie/ua-parser. The parsing itself can be updated outside of updates to the filter itself by configuring the filter to read the regexes from a file.

One minor problem at the moment is that this filter depends on the user_agent_parser gem 2.0.0 which is currently not available from rubygems.org. Not sure how to work around this apart from waiting.

An example of what the filter does:

Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25

becomes

```json
{
"ua": {
"name": "Mobile Safari",
"os": "iOS 6.0",
"device":" iPhone",
"major": "6",
"minor":"0"
}
}