IIS log time is in GMT/UTC, how to change to local time?
Jul 26, 2025 am 04:04 AMThe default logging time of IIS is UTC, which can be converted to local time by modifying the registry, using PowerShell scripts, or log analysis tools. 1. Modify the registry to IIS 6-7 UseLocalTime value to 1 and restart IIS; 2. Use PowerShell scripts to read the log and convert the time fields; 3. Use tools such as LogParser to automatically convert the time during import. Pay attention to backing up the registry, confirming that the server time zone is correct, and keeping the time uniform in a multi-server environment.
The default time for logging in IIS is GMT/UTC. This may cause some trouble if the server is not in the local time zone when troubleshooting problems or analyzing access behavior. Fortunately, there is a way to make the IIS log time display as your local time.

Modify registry settings (for IIS 6 and above)
If you are using older versions of IIS (such as IIS 6 and 7), you can change the time zone of the log time by modifying the registry.
- Open Registry Editor (regedit)
- Find the path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters
- Create a new DWORD value, name it
UseLocalTime
, set the value to1
- Restart the IIS service to make the changes take effect
This method works for most traditional IIS versions, but does not work with some updated versions of IIS 10, as Microsoft removes support for UseLocalTime
in subsequent versions.

Convert log time using PowerShell scripts
If you don't want or cannot modify the server settings, another way is to use a script to convert the time to local time after the log is generated. For example, using PowerShell:
Get-Content C:\inetpub\logs\LogFiles\W3SVC1\u_ex231001.log | ForEach-Object { if ($_ -match '^#') { $_ } else { $fields = $_.Split(' ') $utcTime = [datetime]::ParseExact("$($fields[0]) $($fields[1])", "yyyy-MM-dd HH:mm:ss", $null) $localTime = $utcTime.ToLocalTime() $fields[0] = $localTime.ToString("yyyy-MM-dd") $fields[1] = $localTime.ToString("HH:mm:ss") $fields -join ' ' } }
This script reads the log file, recognizes the time field, converts it from UTC to local time, and then outputs the processed content. You can save it as a .ps1
file to run regularly, or integrate it into the log analysis process.

Automatic time conversion using log analysis tool
If you use log analysis tools such as LogParser, ELK, Splunk, or Graylog, these tools usually support time conversion when importing logs. For example, in LogParser, you can use a statement like this:
SELECT TO_LOCALTIME(TO_TIMESTAMP(date, time)) AS LocalTime, * FROM ex231001.log
This way you can see the local time in the query results without modifying the original log file.
Things to note
- Be sure to back up the registry before modifying it
- Make sure the server's time zone settings are correct, otherwise it may not be accurate even if converted to "local time".
- If it is a multi-server environment, it is important to unify the time format and time zone to avoid confusion when troubleshooting problems
Basically these methods. Different versions of IIS support methods are slightly different, just choose the one that is most suitable for your current environment.
The above is the detailed content of IIS log time is in GMT/UTC, how to change to local time?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

To limit the size of client requests, the maxAllowedContentLength parameter can be modified in web.config, such as setting it to 104857600 (100MB), and synchronizing the maxRequestLength of ASP.NET at the same time; to reasonably set the connection timeout time, it can be modified through the IIS manager or appcmd.exe command, with the default of 120 seconds, and the API scenario is recommended to set it to 30-90 seconds; if the request queue is full, you can increase MaxClientConn and QueueLength, optimize application performance, and enable load balancing to relieve stress.

HighCPUusageinIISworkerprocessesistypicallycausedbyinefficientcode,poorconfiguration,orunexpectedtrafficpatterns.Todiagnosetheissue,firstidentifythespecificw3wp.exeprocessusinghighCPUviaTaskManagerorResourceMonitoranddetermineitsassociatedapplication

When configuring dynamic compression in IIS, selecting content types reasonably can improve performance. First enable the dynamic compression module, install and configure web.config or IIS manager through the server manager. Secondly, set appropriate content types, such as HTML, CSS, JavaScript, and JSON, text content is suitable for compression, while pictures and videos are not suitable. Finally, pay attention to the impact of client compatibility and performance, monitor CPU load, client support status and small file compression effects, and adjust the configuration based on actual traffic to obtain the best benefits.

Configuring HTTP response headers in IIS to optimize cache and improve security can be achieved by setting cache-related headers and adding security response headers. 1. Set cache-related headers: By configuring the clientCache element in the web.config file, set the Cache-Control and Expires headers for static resources, for example, use cacheControlMaxAge to specify the cache time, and fine-grained control can also be performed for specific file types (such as .jpg), but avoid HTML page caching for too long. 2. Add security-related headers: Configure X-Content-Type-Optio through customHeaders in web.config

To solve the IIS application pool authentication account permission problem, first, you need to confirm the identity account used by the application pool. The default is IISAppPool{AppPoolName}, which can be viewed or modified through the IIS manager; secondly, make sure that the account has corresponding permissions to the website physical path (such as D:\MyWebSite). The operation steps are: Right-click the folder → Properties → Security → Edit → Add the corresponding account and set the read, write and other permissions; common errors such as 401.3 is due to lack of read permission, 500.19 may be due to insufficient permissions for web.config file, and failure to upload may be due to lack of write permissions; pay attention to whether the inheritance permissions are effective, the UNC path needs to be configured with a username and password, and it may be necessary to modify it after the username and password.

ToenableandcustomizedirectorybrowsinginIIS,firstinstallandenabletheDirectoryBrowsingfeatureviaServerManagerandIISManager;next,customizetheappearanceusingheaderandfooterHTMLsnippets;thenconfiguredefaultdocumentstopreventunintendeddirectorylistings;fin

VirtualdirectoriesandapplicationsinIISdifferinindependenceandconfiguration.1.Virtualdirectoriesactasaliasestoexternalcontent,sharingtheparentsite’sapplicationpoolandconfiguration,idealfororganizingstaticfileswithoutduplication.2.Applicationsrunindepe

SharedconfigurationinIISallowsmultipleserverstouseacentralizedapplicationHost.configfile,ensuringconsistencyacrossawebfarm.1.Itenablesallserverstopointtoasharedconfigurationlocation.2.SetupinvolvesusingaUNCpath,enablingthefeatureinIISManager,andimpor
