I tried to delete the log files with
log 'remove compressed log files' ::Dir['/var/log/*.gz'].each { |f| ::FileUtils.rm_rf(f) }
My request is to remove them based on mtime.
This is just regular Ruby code, not a DSL chef's recipe. The more chef-ish way to do it would be
Dir['/var/log/*.gz'].each do |path| file path do action :delete only_if { ::File.stat(path).ctime < (Time.now - 60*60*24*7) } end end