How to move log files to a different folder using Logrotate
Move log files to a different folder using Logrotate.
With Logrotate, you can move log files to a different, specific folder. In our example below, we're using Nginx log files:
Edit the logrotate configuration file:
$ nano /etc/logrotate.d/nginx
Use the
olddir
parameter and enter the full path to the new folder as the value:/var/log/nginx/*.log { ... olddir /var/log/nginx/newfolder_for_log ... }
This will move the log files from
/var/log/nginx/
over to/var/log/nginx/newfolder_for_log
folder.Save the
/etc/logrotate.d/nginx
file changes.