Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么logstash将此用户代理解析为IE7_Logstash_User Agent - Fatal编程技术网

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

为什么logstash将此用户代理解析为IE7,logstash,user-agent,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"

我有以下用户代理:

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。下表摘自:

三叉戟令牌

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

然而,用户代理插件似乎关注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

是否有可能修复它,或者我必须自己更改用户代理插件regex,以反映真实的浏览器版本,以便正确存储它


另外,我正在从外部数据库获取记录。

您可以在不进入兼容模式的情况下更改用户代理字符串。开发工具”仿真。我不需要那个。我只想正确的IE版本被解析,无论兼容模式如何。我的记录已存储在外部数据库中。编辑的问题反映了这一点。不管兼容模式如何,都分析了正确的字符串-这就是我所描述的。你们误解了我。我在数据库中有大量的用户代理记录,我想将所有这些导入Logstash并解析它们。因此,如果有一个像我问题中那样的用户代理字符串,我希望得到
“major”:11
,而不是
“major”:7
╔═══════════════╦════════════════════════════════════════════════════════════════════╗
║ 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                                      ║
╚═══════════════╩════════════════════════════════════════════════════════════════════╝