How to remove old log files in SMA

  • KM03178951
  • 13-Jun-2018
  • 13-Jun-2018

Summary

In SMA installation, the log folders sometimes grow too much and can make the system unusable if the hard disk usage is above 80%. It's a good practice to clean up regularly

Question

Sometimes the log folders in SMA grow too much and can result in hard disk usage above 80%, which can lead to system unusable.

It's convenient to check regularly the disk usage and clean up the log folders. For example to remove all log files and folders that haven't been touched in the last 5 days.

Answer

This command in Linux can remove all files and folders under a path that weren't modified in 5 days:
find /path/to/files* -mtime +5 -exec rm -rf {} \;

  • The first argument is the path to the files
  • The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
  • The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.

This applied to a tipical SMA-SM installation could be:
find /var/vols/itom/itsma/itsma-itsma-global/logs* -mtime +5 -exec rm -rf {} \;
or
find  /var/vols/itom/itsma/*/logs* -mtime +5 -exec rm -rf {} \;

PS: Be careful when executing this command, since it'll remove all files and folders without asking for confirmation. In case of doubt, execute only the first part of the command
find  /var/vols/itom/itsma/*/logs* -mtime +5
to see a list of all the files that will be deleted