centos 7.
our devs have an app that wites to logs in /data/Logs
but rotates daily itself
eg
-rw-r--r-- 1 root root 136964 Sep 13 23:59 2020-09-13.log
-rw-r--r-- 1 root root 316076 Sep 14 23:56 2020-09-14.log
-rw-r--r-- 1 root root 248682 Sep 15 23:59 2020-09-15.log
-rw-r--r-- 1 root root 123633 Sep 16 10:31 2020-09-16.log
However this app apparently (according to the dev) has no option to zip the logs > Y days old or to delete logs > X days old. But we do need to housekeep sensibly by zipping anything a day old and deleting any logfile older than 183 days.
The simplest solution is a crontab or two
eg
find /data/Logs/ -name \*.log -type f -mtime +1 -exec gzip -9 {} \;
find /data/Logs/ -name \*.log.gz -type f -mtime +183 -exec rm -f {} \;
However ... crontabs are frownwed up[on (not my call) and we are "requested" to use logrortate where possible for such tasks. [ again, not my call ]
So
- i can't see how one can use logrotate to NOT rotate the logs (as they are already rotated) but to zip them > 1 day and delete them > 180
But ... maybe there is a way so for co0mpleteness I'll ask.
Im not expecting there to be a solution - after all,. its called logROTATE for a reason!
logrotate to zip & remove but NOT rotate...
General support questions
Return to “CentOS 7 - General Support”
Jump to
- CentOS General Purpose
- ↳ CentOS - FAQ & Readme First
- ↳ Announcements
- ↳ CentOS Social
- ↳ User Comments
- ↳ Website Problems
- CentOS 8
- ↳ CentOS 8 - General Support
- ↳ CentOS 8 - Hardware Support
- ↳ CentOS 8 - Networking Support
- ↳ CentOS 8 - Security Support
- CentOS 7
- ↳ CentOS 7 - General Support
- ↳ CentOS 7 - Software Support
- ↳ CentOS 7 - Hardware Support
- ↳ CentOS 7 - Networking Support
- ↳ CentOS 7 - Security Support
- CentOS 6
- ↳ CentOS 6 - General Support
- ↳ CentOS 6 - Software Support
- ↳ CentOS 6 - Hardware Support
- ↳ CentOS 6 - Networking Support
- ↳ CentOS 6 - Security Support
- CentOS Legacy Versions
- ↳ CentOS 4
- ↳ CentOS 4 - General Support
- ↳ CentOS 4 - Software Support
- ↳ CentOS 4 - Hardware Support
- ↳ CentOS 4 - Networking Support
- ↳ CentOS 4 - Server Support
- ↳ CentOS 4 - Security Support
- ↳ CentOS 4 - Webhosting Support
- ↳ CentOS 4 - X86_64,s390(x) and PowerPC Support
- ↳ CentOS 4 - Oracle Installation and Support
- ↳ CentOS 4 - Miscellaneous Questions
- ↳ CentOS 5
- ↳ CentOS 5 - General Support
- ↳ CentOS 5 - Software Support
- ↳ CentOS 5 - Hardware Support
- ↳ CentOS 5 - Networking Support
- ↳ CentOS 5 - Server Support
- ↳ CentOS 5 - Security Support
- ↳ CentOS 5 - Webhosting Support
- ↳ CentOS 5 - X86_64,s390(x) and PowerPC Support
- ↳ CentOS 5 - Oracle Installation and Support
- ↳ CentOS 5 - Miscellaneous Questions