Have you considered logging to the event log system. E.g application log? Rotation can be configured by OS itself, size etc?
Sent from my iPhone On Dec 22, 2014, at 10:59 AM, "Beardsley, James" <[email protected]<mailto:[email protected]>> wrote: I’ve been searching the web and I’m not having any luck finding an answer so hoping someone has come across this before. I’m looking for a way to add logging to my posh script that will only keep 30 days. I’ve found some functions (like this<http://blogs.msdn.com/b/rslaten/archive/2014/07/28/logging-in-cmtrace-format-from-powershell.aspx>) that’ll archive a log like SCCM does after 30 days (ie: rename to .lo_ and create a new .log) but I’d like to have the logging function continue using the same log file but just delete the older lines from the bottom and continue adding to the top so it’s a continuous 30 days at all times. Or maybe it’d be easier to measure by the number of lines. My script runs every hour and logs one line to a log file each time. So a months worth of logging should be around 720 lines if my math is correct and it could delete lines over 720 and continue adding to the top. Is that even possible? Thanks, James ________________________________ Confidentiality Notice: This e-mail is intended only for the addressee named above. It contains information that is privileged, confidential or otherwise protected from use and disclosure. If you are not the intended recipient, you are hereby notified that any review, disclosure, copying, or dissemination of this transmission, or taking of any action in reliance on its contents, or other use is strictly prohibited. If you have received this transmission in error, please reply to the sender listed above immediately and permanently delete this message from your inbox. Thank you for your cooperation.

