I had a server with a system drive low on disk space. Manually clearing the diagnostic log files resolved the issue, but only temporarily. I needed to clear the log files on a schedule until the disk could be expanded. This script was used as a scheduled task.