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 {
        daily
        missingok
        rotate 1
        compress
        create
}
  • /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
  • missingok: don’t write an error message if the log file is missing
  • 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
  • create: this creates a new empty log file after rotation
# Run Default Logrotate-Config in Debug Mode
sudo logrotate /etc/logrotate.conf --debug

References:

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.)