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.

Plicatibu
  • 101
  • 3

1 Answers1

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.

Jason Martin
  • 5,023
  • 17
  • 24
  • 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 07 '16 at 16:57