Octopus Tools | Maintenance of log files



Whenever an Octopus tool, such as MailIntegration, is executed, a log file is created. By default the file is created in the Octopus folder of the computer that ran the program. 

Which means in some cases, especially with MailIntegration that hundreds of log files could be created in one day. It is therefore necessary to manage / archive these files so that they do not take up too much space.

File Management

It is recommended to check each of the Octopus administration tools used to see if there is any need to manage log files.

Octopus tools are:

Manage With a Windows Task

We recommend keeping 30 days of log history to assist the investigation in case of a problem.

To delete the files in a Windows task, use the DOS ForFiles command, for example:

:: Create a temporary variable environment

:: The number of days of history to keep
   SET OctopusLogCleaner.Delay=30

:: The name of the application for which to destroy the logs
   SET OctopusLogCleaner.Tool=MailIntegration

:: The folder in which to purge the files
   SET OctopusLogCleaner.Path=%LocalAppData%\Octopus

:: Search all files matching the search mask in the folder being older
:: than the retention period to delete them
   FORFILES.exe ^ 
     /M %OctopusLogCleaner.Tool%*.log ^
     /D -%OctopusLogCleaner.Delay% ^
     /P %OctopusLogCleaner.Path% ^
     /C "cmd.exe /c DEL @path"

:: Destroy the temporary variable environment

Automation coming soon

A tag to automate log file management will soon be added in Octopus to help with this task.

Help us improve our articles

Help us improve our articles