logstash-plugins / logstash-filter-useragent

Apache License 2.0
11 stars 36 forks source link

ua-parser is not providing the device brand and model details #63

Open ChimbuChinnadurai opened 5 years ago

ChimbuChinnadurai commented 5 years ago

logstash ua-parser is not providing the device brand and model details. Below is the useragent string which i parsed in the python parser and can see its provided the device branch & model details which is very helpful for our reports.

"clientUserAgent": "MobileApp/1.3.19-Release (iPhone9,3; CPU iPhone OS 12_4 like Mac OS X)"

python ua-parser output:

"clientUserAgent": {
  "user_agent": {
    "major": null,
    "patch": null,
    "minor": null,
    "family": "Mobile Safari UI/WKWebView"
  },
  "device": {
    "brand": "Apple",
    "model": "iPhone9,3",
    "family": "iPhone"
  },
  "os": {
    "major": "12",
    "patch_minor": null,
    "patch": null,
    "minor": "4",
    "family": "iOS"
  },
  "string": "MobileApp/1.3.19-Release (iPhone9,3; CPU iPhone OS 12_4 like Mac OS X)"
}

But logstash ua-parser is missing the device branch and model details. Used the mutate filter and renamed the output.

logstash ua-parser output:

"clientUserAgent.device.family": "iPhone",
"clientUserAgent.os.family": "iOS",
"clientUserAgent.os.patch": "1",
"clientUserAgent.os.major": "12",
"clientUserAgent.os.minor": "4",
"clientUserAgent.user_agent.family": "Mobile Safari UI/WKWebView",
"clientUserAgent.string": "MobileApp/1.3.19-Release (iPhone9,3; CPU iPhone OS 12_4 like Mac OS X)"
npipet commented 4 years ago

Parser used in the filter has all the details of device (family, model and brand), but only family is keep and forced in the device entry... :(

I think it is not really hard to add these data in the file lib/logstash/filters/useragent.rb, around line 138.

fabiogermann commented 2 years ago

@npipet @ChimbuChinnadurai I have prepared a version over here: https://github.com/fabiogermann/logstash-filter-useragent But currently I have issues running the jruby tests See: https://github.com/logstash-plugins/logstash-filter-useragent/pull/77