How to Clean/Delete Old Log Files Using Script

Issue

Cleaning/deleting the old log files in Infoworks using a script.

Cause

Infoworks generates different type of logs like Hangman logs, Apricot logs, Infoworks Logs, Cube Logs, etc. Over a period of time, these files consume the disk space in the Infoworks edge node. To resolve this issue, you can clean the older logs based on the retention policy (if any).

Solution

  • Use the log_cleanup script provided by Infoworks in the $IW_HOME/apricot-meteor/scripts/log_cleanup.sh location.

NOTE: To execute this script, ensure you choose the *correct *folder for the logs cleanup start date and end date of the generated logs in the specific folder.

  • Navigate to $IW_HOME/bin and run the following command:
  • source env.sh*
  • Navigate to the IW_HOME/apricot-meteor/scripts/ folder and run the following command:
  • sh log_cleanup.sh -h*
  • Use the following syntax to delete the logs:

sh log_cleanup -d=directoryname_with_complete_path -sd=YYYY-MM-DD -ed=YYYY-MM-DD

For example, to delete the logs present in the logs folder, from start date 2018-01-01 to end date 2018-01-10, run the following command:

sh log_cleanup.sh -d=$IW_HOME/logs/ -sd=2018-01-01 -ed=2018-01-10

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard