Our school uses a fairly niche proxy server for securing access to a bunch of online periodicals – stuff students can use for research. It’s a simple little server, the kind of set-it-and-forget-it stuff that just keeps working.
So when I logged in the other day to review the log file, I was surprised – this server (EZProxy) creates ezproxy.log, but never clears it. I had events going back to 2006, before I worked here. Someone set it and forgot it, and now there was a text file that was over 114 MBs.
You should never have a text file this big. It took Notepad a really long time to open it, and it hurt the server. Something had to be done to fix this, before the log file became useless, threatened the proxy server system’s stability, or both.
Obviously, starting with a batch file kicked off from a scheduled task is one clean way to do it.
net stop ezproxy
move c:\ezproxy\ezproxy.log “c:\ezproxy\ezproxy-log-%date:~10,4%%date:~4,2%%date:~7,2%.txt”
net start ezproxy
This stops the service using the log file, and renames the file with a date stamp of YYYYMMDD. Then it restarts the service, which automatically creates a new log file.
Then, I set a scheduled task to kick it off at 1 am on the first day of every month. That should take care of that.