Reputation: 16753
Our analytics engine reads IIS logs and I want to know if the query string is included in these, in a default IIS7 setup.
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
?
Upvotes: 4
Views: 6261
Reputation: 119856
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
- which will be the /page
part of your urlcs-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.If there isn't a query string value present in the url then you'll see a hyphen (-
) in the cs-uri-query
field.
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.
You might also find this answer I gave a while back useful which has some other nuggets of information regarding IIS log files:
Upvotes: 7