While this isn't native to the Elastic stack it is possible with a log rotate script. On Linux you would use logrotate as described here:
In your case on Windows I found this powershell script option on TechNet: Browse code samples | Microsoft Learn
The powershell script doesn't meet exactly the needs you spelled out but could be modified to meet what you're looking for.