Delete IIS Log Files in Windows 10: Easy & Safe
To delete IIS log files in Windows 10 safely and easily, use the built-in Disk Cleanup tool or manually clear the %SystemDrive%\inetpub\logs\LogFiles folder after stopping the IIS service (W3SVC). This removes old logs without risking active file locks or corrupting current logging.
Why IIS Log Files Accumulate
Internet Information Services (IIS) on Windows 10 writes a separate log file for each website and each day. By default, logs are stored in C:\inetpub\logs\LogFiles\W3SVC[site ID]. A single site can generate hundreds of kilobytes to several megabytes per day, depending on traffic. Over months, these files consume significant disk space, especially on development machines or servers running multiple sites.
IIS creates a new file daily with names like u_ex210101.log (YYMMDD format). The service keeps files open only while actively writing, but old files remain until manually removed or until a configured retention policy kicks in. Windows 10 does not automatically prune IIS logs, so manual or scheduled cleanup is necessary.
Method 1: Using Disk Cleanup (Safest)
Disk Cleanup is the safest method because it handles file locks and only removes files that are not in use.
- Press Win + S, type Disk Cleanup, and open the app.
- Select the drive where IIS logs are stored (usually C:) and click OK.
- Wait for the scan, then click Clean up system files (this requires administrator rights).
- In the list, check Internet Information Services Log Files.
- Click OK and confirm deletion.
This removes all IIS logs older than the current day. It does not delete the active log file, so no interruption occurs.
Method 2: Manual Deletion with Service Stop
If you need to delete logs immediately or want to remove specific files, stop IIS first to avoid file-lock errors.
- Open Command Prompt as Administrator.
- Run
iisreset /stopto stop IIS (or usenet stop W3SVC). - Navigate to
C:\inetpub\logs\LogFilesin File Explorer. - Select the folders and files you want to delete (e.g.,
W3SVC1for site ID 1). - Press Shift + Delete to permanently remove them, or right-click and delete.
- Restart IIS with
iisreset /startornet start W3SVC.
If you try to delete while IIS is running, you may get a “file in use� error for the current day’s log. Stopping the service avoids this.
How to Choose Which Logs to Delete
You don’t have to delete everything. Consider these factors:
- Age: Delete logs older than 30 days if you don’t need them for troubleshooting.
- Size: Sort by size in File Explorer to find large files that are safe to remove.
- Site ID: Delete only specific site folders if you know which site generates the most logs.
- Date pattern: Use the filename date (u_exYYMMDD.log) to keep only recent days.
For regular cleanup, set up a scheduled task using Task Scheduler to run a PowerShell command like Get-ChildItem -Path C:\inetpub\logs\LogFiles -Recurse -Filter *.log | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | Remove-Item.
Common Problems and Fixes
“File in use� error: This happens when IIS is actively writing to the log. Stop the W3SVC service or wait until the next day.
Disk Cleanup doesn’t show IIS logs: Make sure you clicked “Clean up system files� after the initial scan. The IIS log option only appears there.
Logs reappear after deletion: IIS recreates logs when new requests come in. That’s normal—you’re not deleting the logging feature, just old files.
Permission denied: The inetpub folder is protected. Run File Explorer or Command Prompt as Administrator.
Alternative: Compress Instead of Delete
If you need to keep logs for compliance or analysis, compress them instead of deleting. Right-click the folder, select Properties > Advanced, and check “Compress contents to save disk space.� Or use a zip tool to archive old logs to another drive. This preserves data while freeing space.
Another option is to change IIS logging settings to a different directory or reduce log detail (e.g., log only errors) via IIS Manager > Sites > Logging. This reduces future file growth but doesn’t clean existing files.
Safety and Best Practices
Always back up logs before deletion if you might need them for audit or debugging. Use Disk Cleanup for a one-time safe cleanup, and avoid manually deleting the W3SVC folder while IIS is running. For scheduled cleanup, test the PowerShell command on a few files first.
Also check if you have multiple IIS sites—each has its own subfolder (W3SVC1, W3SVC2, etc.). Deleting one folder doesn’t affect others. Finally, remember that logs are plain text; they contain IP addresses and request URLs, so ensure you have permission to delete them under your organization’s data retention policy.
Frequently Asked Questions
Will deleting IIS logs affect my websites? No. Logs are for record-keeping only. Deleting them does not change site behavior or performance.
Can I delete logs without stopping IIS? Yes, for files older than the current day. The active log file is locked, but older ones are not.
Where are IIS logs stored in Windows 10? By default, in C:\inetpub\logs\LogFiles, with subfolders per site ID.
How often should I clean IIS logs? Depends on traffic. For a busy site, monthly cleanup is common; for a development PC, every few months is fine.
Is there a built-in retention setting? IIS does not have a UI for automatic deletion. You must use Disk Cleanup, a scheduled task, or a third-party tool.
What if Disk Cleanup doesn’t free enough space? Use the manual method or compress the folder. Also check if other system files are taking up space.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.