Linux Log Rotate and archive rotated file.
I was checking an article on how to upload archived logs to azure blob. As initial set up I’ve updated logrotate.conf(/etc/logrotate.conf) with below settings.
file to edit: /etc/logrotate.conf
{% gist 5d2a8a1bf8cb0f619b45a39785dee395 %}
Then updated syslog rotate config to test on how messages files can be archived. Make sure the destination path is created. In this case I’ve got /opt/logs/ referenced. file edited /opt/logrotate.d/syslog
{% gist bacb68f7f66e346d1d80f2a934c00856 %}
This will ensure the last rotated log file would be copied to /opt/logs/. You can have any other scripts configured to upload to blob from here. Once these settings are in place test run(force run) logrotate -f /etc/logrotate.conf. Result of the operation can be found below