0

I'm generating files daily named as my_file_YYYYMMDD.csv (for instance, my_file_20160406.csv, my_file_20160407.csv and so on).

I want logrotate to compress them daily and that it keep just the last 30 files.

The problem is that it's generating files as cisco_counters-20160406.csv.1.gz and they will never be removed.

How could I make logrotate compress my files, remove the .csv file and remove all compressed files older than 30 days?

Note: unfortunately I'm not allowed remove the date from my files.

Thanks.

0

Rather than logrotate, take a look at 'tmpwatch' which will remove files that have not been modified more then X hours (--mtime). I use that when the files don't fit into logrotate's structure.

1
  • Thanks for the suggestion, but I'm not allowed to install anything in the server and it doesn't have neither tmpwatch nor tmpreaper. – Plicatibu Apr 7 '16 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.