IMPORTANT ANNOUNCEMENT: On May 6, 2024, Carbon Black User eXchange (UeX) and Case Management will move to a new platform!
The Community will be in read-only mode starting April 19th, 7:00 AM PDT. Check out the blog post!
You will still be able to use the case portal to create and interact with your support cases until the transition, view more information here!

CB Response: How to Add a Log Removal Cron Job

CB Response: How to Add a Log Removal Cron Job

Environment

  • CB Response Server: All Versions
  • Linux: All Supported Versions

Objective

Create a cron job to remove log files older than a certain amount of time

Resolution

  1. Edit the /etc/cb/cron/cb.cron.template file 
  2. Add the following line replacing <folder> with the folder to delete logs from 
  3. 0 0 * * * root find /var/log/cb/<folder> -name *.log -mtime +7 -delete
  4. Restart the CB Response services

Additional Notes

  • To change the time the job runs, change the cron formatted value 0 0 * * * to the preferred runtime
  • To change the age of files to be deleted, edit the +7 value to the preffered number of days
  • For a non-permanent setting, add the line to /etc/cron.d/cb. The setting will be wiped in the next service restart according to what is in cb.cron.template

Related Content


Labels (1)
Tags (2)
Was this article helpful? Yes No
No ratings
Article Information
Author:
Creation Date:
‎02-19-2019
Views:
1032
Contributors