Why is the 'Date Modified' field within Windows File Explorer for the UiPath Orchestrator log files not updating even though all other columns (for instance 'Size') and the file in itself are updating correctly?
Issue Description
By default, Orchestrator (22.10+), keeps log files open even when not actively writing events to it. This causes the 'Date Modified' attribute in Windows File Explorer to not update automatically (unless the IIS/Server is restarted) as the attribute is updated only upon file closure. For third-party software such as Splunk, this messes with the log ingestion that is dependent on the Date Modified.
Resolution
Orchestrator log writing behavior can be modified via the "UiPath.Orchestrator.dll.config" file (C:\Program Files (x86)\UiPath\Orchestrator) by adding the following two parameters to the specific <target> in the <targets> section of the config:
- keepFileOpen: Set this attribute to "false" to make sure the file is closed after log events are written. This ensures that Windows immediately notices the change and updates the 'Date Modified' attribute.
- openFileCacheTimeout: This is the number of seconds before a file that's open for writing is forcibly closed. Decrease this value to close the file more often. Again, this will help ensure that Windows notices changes to the file and updates the 'Date Modified' attribute.
Example code:
<target xsi:type="File" name="executionFile" fileName="L:/Logs/${shortdate}_Robot.log" layout="{replace-newlines:${event-properties:item=rawMessage}}" concurrentWrites="true" keepFileOpen="false" openFileCacheTimeout="1" />
