You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a log file constantly being written to by an application, and have attempted to use copytruncate so that the original log file can continue to be used. I receive this error in the Log-Rotate.log
Truncating C:\utils\stunnel\stunnel.log
Process-Local-Block : Exception calling "RotateMainOnly" with "0" argument(s): "The running command stopped because
the preference variable "ErrorActionPreference" or common parameter is set to Stop: The process cannot access the file
'C:\utils\stunnel\stunnel.log' because it is being used by another process."
At C:\Program Files\WindowsPowerShell\Modules\Log-Rotate\1.5.3\public\Log-Rotate.ps1:207 char:13
+ Process-Local-Block -block $block @blockoptions
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], MethodInvocationException
+ FullyQualifiedErrorId : ScriptMethodRuntimeException,Process-Local-Block
I believe this happens because copytruncate is not correctly implemented. The actual behavior should allow a low level shifting of the file offset using O_APPEND, see https://unix.stackexchange.com/questions/475524/how-copytruncate-actually-works. I'm not sure how to implement this in powershell, so assume that copytruncate is non-functional.
A workaround is to stop that process using prerotate, and start the process using postrotate. But that would mean downtime of the process for the duration of the rotation, and lost logs etc. Hope that helps.
I have a log file constantly being written to by an application, and have attempted to use copytruncate so that the original log file can continue to be used. I receive this error in the Log-Rotate.log
My stunnel-log.conf file is:
The text was updated successfully, but these errors were encountered: