为什么logstash将此用户代理解析为IE7

时间:2015-10-30 13:03:16

标签: logstash user-agent

我有以下用户代理:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)

将哪个发送到logstash和用户代理插件将其解析为IE7。具体来说,就像那样:

{
  "name" : "IE",
  "os" : "Windows 7",
  "os_name" : "Windows 7",
  "major" : 7
}

然而,它实际上是IE11。以下表格取自M$ documentation

三叉戟令牌

  

当使用F12开发人员工具更改浏览器模式时   Internet Explorer,用户代理字符串的版本标记是   修改为显示,以便浏览器显示为更早   版。这样做是为了允许提供特定于浏览器的内容   到Internet Explorer,通常只有在网站有时才需要   尚未更新以反映当前版本的浏览器。当这个   发生这种情况时,会将三叉戟令牌添加到用户代理字符串中。这个令牌   包括一个版本号,使您可以识别的版本   浏览器,无论当前的浏览器模式如何。

╔═════════════╦══════════════════════╗
║    Token    ║     Description      ║
╠═════════════╬══════════════════════╣
║ Trident/7.0 ║ IE11                 ║
║ Trident/6.0 ║ Internet Explorer 10 ║
║ Trident/5.0 ║ Internet Explorer 9  ║
║ Trident/4.0 ║ Internet Explorer 8  ║
╚═════════════╩══════════════════════╝

然而,似乎用户代理插件会关注MSIE X.0以反映主要版本。这是文档中的另一个表:

╔═══════════════╦════════════════════════════════════════════════════════════════════╗
║ Version token ║                            Description                             ║
╠═══════════════╬════════════════════════════════════════════════════════════════════╣
║ MSIE 10.0     ║ Internet Explorer 10                                               ║
║ MSIE 9.0      ║ Internet Explorer 9                                                ║
║ MSIE 8.0      ║ Internet Explorer 8 or IE8 Compatibility View/Browser Mode         ║
║ MSIE 7.0      ║ Windows Internet Explorer 7 or IE7 Compatibility View/Browser Mode ║
║ MSIE 6.0      ║ Microsoft Internet Explorer 6                                      ║
╚═══════════════╩════════════════════════════════════════════════════════════════════╝

所以这意味着即使它是IE11,由于兼容模式,它也会被解析为IE7。

是否可以修复它,或者我必须自己更改用户代理插件正则表达式以反映真正的浏览器版本才能正确存储它?

P.S。我从外部数据库中获取记录。

0 个答案:

没有答案
相关问题