默认情况下,IIS7日志是否请求查询字符串? [英] Does IIS7 log request query string by default?

查看:78
本文介绍了默认情况下,IIS7日志是否请求查询字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的分析引擎读取IIS日志,我想知道查询字符串是否包含在默认的IIS7设置中.

Our analytics engine reads IIS logs and I want to know if the query string is included in these, in a default IIS7 setup.

例如,如果用户请求http://mysite.com/page?to=otherpage,日志中是否会包含http://mysite.com/page?to=otherpagehttp://mysite.com/page?

For example, if a user requests http://mysite.com/page?to=otherpage will the logs contain http://mysite.com/page?to=otherpage or http://mysite.com/page?

推荐答案

在服务器或特定站点的日志记录设置中(我通常会全局配置日志记录),前提是您已选择URI Query (cs-uri-query)日志记录字段,然后IIS将记录查询字符串:

In the Logging settings for the Server or a specific site (I usually configure logging globally), provided you've selected the URI Query (cs-uri-query) logging field then IIS will log the query string:

您可以使用以下命令一次启用所有字段:

You can enable all of the fields at one using:

appcmd set config -section:sites -siteDefaults.logFile.logExtFileFlags:Date,Time,ClientIP,UserName,SiteName,ComputerName,ServerIP,Method,UriStem,UriQuery,HttpStatus,Win32Status,BytesSent,BytesRecv,TimeTaken,ServerPort,UserAgent,Cookie,Referer,ProtocolVersion,Host,HttpSubStatus

在日志文件中,您将看到两个字段:

In your log file you'll see two fields:

  • cs-uri-stem-这将是您网址的/page部分
  • cs-uri-query-代表查询字符串,例如to=otherpage&life=42.您将不会看到问号,因为它被剥离了.
  • cs-uri-stem - which will be the /page part of your url
  • cs-uri-query - which represents the query string e.g. to=otherpage&life=42. You won't see the question mark as this is stripped off.

如果url中没有查询字符串值,那么您会在cs-uri-query字段中看到一个连字符(-).

If there isn't a query string value present in the url then you'll see a hyphen (-) in the cs-uri-query field.

关于默认值是什么...我不记得了.这是因为我们是根据一组模板和黄金映像构建服务器的,这些模板和黄金映像并非真正的普通IIS7框,并且已启用所有日志记录字段.

As to what the defaults are...I can't remember off the top of my head. This is because we build our servers off of a set of templates and gold images which aren't really plain vanilla IIS7 boxes, and have all the logging fields already enabled.

但是,在全局日志记录设置周围有个戳记,您很快就会发现(假设自服务器构建以来没有人碰过这些设置).

However have a poke around the global logging settings and you'll soon find out (assuming someone hasn't touched these since the server was built).

最后,除非您在站点级别本地覆盖,否则全局日志记录设置将被服务器上的所有站点继承.

Finally, the global logging settings will be inherited by all the sites on your server unless you override locally at the site level.

您可能还会发现我刚才给出的答案很有用,其中包含有关IIS日志文件的其他信息:

You might also find this answer I gave a while back useful which has some other nuggets of information regarding IIS log files:

https://stackoverflow.com/a/11298241/419

这篇关于默认情况下,IIS7日志是否请求查询字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆