34 lines
2.4 KiB
Markdown
34 lines
2.4 KiB
Markdown
# Clean-up-CMS-log-files_686073699
|
|
You may find that the size of logs on your file storage, especially the <cms-log-volume> folder, keeps growing. For example, the size of the <cms-log-volume> folder may reach 120 GB after CMS has been running for a few months. To reduce the log size, you can safely remove or archive old log files in the log folders while the CMS is running.
|
|
|
|
### How to delete log files from a log folder
|
|
|
|
You can delete log files that are older than certain days ( for example, 60 days) from your file storage. To do this, run the following command on the file storage server:
|
|
|
|
nohup find {log folder} -type f -atime +{day} -mtime +{day} -ctime +{day} -exec stat '{}' \\+, -type f -atime +{day} -mtime +{day} -ctime +{day} -exec rm -f '{}' \\+ > {output.log} &
|
|
|
|
Where:
|
|
|
|
- {log folder}: is the folder from which you want to delete the log files that meet the specified condition
|
|
- {day}: specify the same value (in days) for the atime, mtime, and ctime parameters:
|
|
- **mtime**: modification time, the time when the file was last modified. When the content of a file changes, its mtime changes.
|
|
- **ctime**: change time, the time when the file's property changes. It always changes when the mtime changes, and also changes when the file's permissions, name or location changes.
|
|
- **atime**: access time, which is updated when the file is read by an application or a command such as grep or cat
|
|
- {output.log} is the log file to which you want to write the output log message
|
|
|
|
Log folders to clean up
|
|
|
|
Normally, you only need to clean up the following log folders on the NFS server:
|
|
|
|
| **Log folder** | **Example 1** | **Example 2** | **Note** |
|
|
| --- | --- | --- | --- |
|
|
| <cms-log-volume>/logs | /var/vols/itom/cms/log\_volume | /mnt/cms/var/vols/itom/cms/log\_volume | <cms-log-volume> is the CMS log NFS volume |
|
|
|
|
The following example commands will delete all the files in the specified folders when all of their atime, mtime, and ctime values are older than 60 days.
|
|
|
|
**nohup find /mnt/cms/var/vols/itom/cms/log\_volume -type f -atime +60 -mtime +60 -ctime +60 -exec stat '{}' \\+, -type f -atime +60 -mtime +60 -ctime +60 -exec rm -f '{}' \\+ > /tmp/cleanupCMS.log &**
|
|
|
|
Note:if you meet 'permission deny' error when running the command, you can add sudo:
|
|
|
|
**nohup find /mnt/cms/var/vols/itom/cms/log\_volume -type f -atime +60 -mtime +60 -ctime +60 -exec stat '{}' \\+, -type f -atime +60 -mtime +60 -ctime +60 -exec sudo rm -f '{}' \\+ > /tmp/cleanupCMS.log &**
|