问题
According to this documentation you can configure IIS 10 on Windows Server 2016 to write custom fields as long as "The total amount of data added in custom fields cannot exceed 65,536 bytes"
I have configured a custom field to write the cookies from Header and another from the server variable into the logs and this works just fine.
But only 4096 bytes are written to the log no matter what value I put in maxCustomFieldLength.
When I send 8k of data in the cookies and I:
- set maxCustomFieldLength to 4096 I only get 2048 bytes in the log file.
- increase maxCustomFieldLength to 65536, I only get 4096 bytes in the log file.
I have verified using fiddler that the browser requests are sending the full 8k cookies value and that they are not truncating the value to 4096 at the client.
Any ideas why IIS is truncating the cookies value to 4096 and not respecting maxCustomFieldLength greater than 4096?
回答1:
Having done extensive research into this now, the only way I have found to get all the cookies logged to the standard IIS log files when they are < 4k is to write a custom HttpModule that:
- hooks into Begin_Request
- reads the raw cookies string from the Request Headers
- splits it into chunks < 4k (preserving entire cookies as whole items, name and value)
- write the chunks into custom request headers
- configure IIS with a bunch of new custom fields to drop the new request headers into the iis logs
来源:https://stackoverflow.com/questions/52928925/cant-write-more-than-4096-bytes-into-custom-iis-log-field