Freigeben über


Forcing IIS to write logs (HTTP and FTP)

I was assisting a customer who was trying several different configurations but his IIS log was not reflecting any of these changes. This can be frustrating at times since you always expect the logs to be written corresponding to your actions. By default, starting with IIS 7.0, IIS HTTP logs are written once every 1 minute or at 64kb whichever comes first. The FTP logs are written once every 6 minutes. Basically the logs are buffered for performance reasons and are written at these predefined intervals.

If these default values do not work for you, then please read on…..

Steps to force IIS to write HTTP logs (forces all entries in the log buffer to be written from the buffer into the log file):

  1. Open a command prompt with administrative privilege
  2. cd C:\Windows\System32
  3. netsh http flush logbuffer

Steps to force IIS to write FTP logs (forces all entries in the log buffer to be written from the buffer into the log file):

  1. Call the FlushLog method which works at the FTP site level. There is no control in the IIS Manager that calls the <FlushLog> method. You can call the method programmatically using the sample code that is provided here: /en-us/iis/configuration/system.applicationHost/sites/site/ftpServer/flushlog