Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: typo

Include Page
KBCOMMON:KB-CSSstyle
KBCOMMON:KB-CSSstyle
Anchor
TOC
TOC
Version: 7 - Published:  

...

  • Retention parameters:
    • -keep    = minimum number of log files to keep in all cases (default = 3, minimum = 1)
      • Overrides the next 2 parameters
      • Keeps the most recent ones
    • -daysarc = number of days to keep the log files before archiving (zipping) them (default = 35 days)
      • The script will look for all log files with .log extension, older than "daysarc" days, and will zip them (if possible)
    • -daysdel = number of days to keep the log and zipped files before deletion (default = 90 days)
      • The script will look for all log files with .log and .zip extension, older than "daysdel" days, and will delete them (if possible). The script will:
        • delete all zipped files older than "daysdel" days in case they have been zipped thanks to the "daysarc" parameter above
        • delete all log files older than "daysdel" days in case they have not been zipped (either too old, unzipped manually or if version of PowerShell is below 5.1)
      • Value must be greater than "daysarc". If this is not the case, the script will:
        • display a warning message,
        • force the value to be "daysarc + 7" and continue
    • -install = installation mode as a scheduled job (see chapter "Scheduled task mode583663691" below)
  • Others:
    • -ini <file> = optional configuration file (see below) containing customized values for the retention parameters (keep, daysarc, daysdel). Please note if retention parameters are passed, they will overwrite the file content.
    • -help = display usage information

...

Scheduled task mode

The script prtovides provides an auto-installer to create a scheduled job that will run each day at 1:00 AM.

...

PS C:\Charon> .\charon_logarchive.ps1 -install

[Info] Data folder found: 'C:\Program Files\CHARON\Toolkit\LogArchiver'
Please specify the following attributes
Number of days to keep the log files before archiving (zipping) them [100] :

Number of days to keep the log and zipped files before deletion [180] :

Minimum number of log files to keep in all cases [5] :

[Info] Scheduled task created in \CHARON folder, name: 'Charon logs archiving'
[Info] Runs everyday at 01:00 AM.

...