locked
Large Log Files RRS feed

  • Question

  • Hi All , 

    I have a script that automate tasks and inject entries in a log file , the problem i have is after a few months of running it the log file became large like 5 MB and i want it always small. 

    I thought to do something like configuration manager where SCCM always create new Log file once the older one become large . 

    Do i have anything built in powershell that do that or should i hard code it and write a script that check the file size and create a new log if necessary ?

    Thanks 

    Monday, May 11, 2020 9:00 PM

Answers

  • You will have to write that yourself or explore some extended logging capabilities that are available through Visual Studio and third party tools.  There is nothing currently in PS that does this.

    You should also search the PowerShellGallery for any modules that may implement what you are looking for.

    help find-module -online

    Start by running this command:

    find-module -Tag logging


    \_(ツ)_/


    • Edited by jrv Monday, May 11, 2020 9:16 PM
    • Marked as answer by springhh Tuesday, May 12, 2020 12:28 AM
    Monday, May 11, 2020 9:15 PM