This article has not been completed yet. However, it may already contain helpful information and therefore it has been published at this stage.

# Verify that logrotate is installed
logrotate --version
#  Check Loglocations, that have to be rotated
ls /var/log/remotelogs/
# Create a new Logrotate-Configuration File
sudo nano /etc/logrotate.d/rsyslog-remote
/var/log/remotelogs/**/*.log {
        su root adm
        maxsize 30G
        rotate 1
            invoke-rc.d rsyslog stop > /dev/null
            invoke-rc.d rsyslog start > /dev/null
  • /var/log/remotelogs/**/: these two stars will match zero or more (sub-) directories
  • /*.log: all files, that ends with ".log", will be processed
  • daily: daily rotation. This overrides the weekly default
  • su root adm: use the adm group to execute the rotation
  • maxsize: once this file size has been reached, the rotation is initiated
  • missingok: don’t write an error message if the log file is missing
  • create: this creates a new empty log file after rotation
  • rotate 1: keep one old log files. This overrides the rotate 4 default
  • compress: compress the rotated files. this uses gzip by default and results in files ending in .gz
  • sharedscripts: the prerotate or postrotate script are only executet for one time
  • prerotate: executed before the log file is rotated
  • endscript: this marks the end of the script area
  • postrotate:  executed after the log file is rotated
  • endscript: this marks the end of the script area
# Run Default Logrotate-Config
sudo logrotate /etc/logrotate.conf

# Run Default Logrotate-Config in Debug Mode (without any changes)
sudo logrotate /etc/logrotate.conf --debug

# Run Default Logrotate-Config in Verbose Mode (files, where no adjustment are necessary are skipped)
sudo logrotate /etc/logrotate.conf --verbose

# Run Default Logrotate-Config in Verbose \ Enforced Mode (all files are processed)
sudo logrotate /etc/logrotate.conf --verbose --force


How To Manage Logfiles with Logrotate on Ubuntu 20.04 | DigitalOcean
Logrotate is a system utility that manages the automatic rotation and compression of log files. If log files were not rotated, compressed, and periodically pruned, they would eventually consume all available disk space on a system. In this article, we will explore the default Logrotate configuration…
logrotating files in a directories and its subdirectories
Is it possible to get logrotate to consider logfiles in a directory and all its subdirectories? (i.e. without explicitly listing the subdirectories.)
logrotate(8) - Linux man page
logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and ...