IIS7 post #42 - Flush log buffer immediately to disk

This is a handy feature I discovered in Windows Server 2008.  You can force http.sys to flush cached log entries immediately to disk.  The next time you are waiting for requests to flush to your IISLogs, go to the command prompt and type

netsh http flush logbuffer 
You'll see an Ok.  

Then open your log files and your entries should be present.

Take care,

Steve

Published Wednesday, June 20, 2007 12:46 AM by steve schofield
Filed under:

Comments

# re: IIS7 post #42 - Flush log buffer immediately to disk

Wednesday, June 20, 2007 6:32 AM by Rachit

Good info.

I was wondering if there's any way to have IIS write the logs in multiple locations. Basically, I want to implement the real-time stats and the closest I can get using IIS logs is hourly.

Can you think of any other way (except writing my own HttpModule and every request would parse through that)?

# re: IIS7 post #42 - Flush log buffer immediately to disk

Wednesday, June 20, 2007 11:39 AM by Bill Staples

I think this works on windows 2003 as well.... I could be wrong.  The new netsh http cache commands are new to windows 2008, and those are handy if you are using kernel caching.

# re: IIS7 post #42 - Flush log buffer immediately to disk

Wednesday, June 20, 2007 5:49 PM by steve schofield

Hi Bill.  I couldn't figure out how to do this exact command on IIS6.  Do you know if this is hid somewhere else?!

# re: IIS7 post #42 - Flush log buffer immediately to disk

Wednesday, June 20, 2007 5:50 PM by steve schofield

Rachit.  You would need to write your own HTTP module or ISAPI component.  Check out Bill Staples example of using SQL logging with the integrated pipeline on IIS7.

blogs.iis.net/.../building-an-iis7-sql-logging-module-with-net.aspx

# Interesting Finds: June 20, 2007

Wednesday, June 20, 2007 9:08 PM by Jason Haley

# Soci blog » Blog Archive » IIS7 log azonnali ki??rat??sa

Pingback from  Soci blog  » Blog Archive   » IIS7 log azonnali ki??rat??sa

# re: IIS7 post #42 - Flush log buffer immediately to disk

Friday, November 09, 2007 1:32 AM by darickard

Nice time saver, thanks! Works on Vista Home Premium.