"Logrotate" not working
Image: "sha256:b10f37af5f3e7115b128e1aed895963a9b36e11dcb137a1b43a8de64b0d9bd3d"
root@83cab7e96087:/srv/www# cat /etc/cron.d/logrotate
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# to prevent spamming from CRON daemon, set env variable to 'null' value
MAILTO=''
HOME=/srv/www
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
14 * * * * root bash -l -c '/usr/sbin/logrotate /etc/logrotate.conf &> /var/log/logrotate.log'
root@83cab7e96087:/srv/www# cat /etc/logrotate.conf
/srv/www/var/log/*.log {
su www-data www-data
daily
missingok
rotate 14
compress
notifempty
create 0640 www-data www-data
}
root@83cab7e96087:/srv/www# which /usr/sbin/logrotate
/usr/sbin/logrotate
root@83cab7e96087:/srv/www# /usr/sbin/logrotate -v
logrotate 3.14.0 - Copyright (C) 1995-2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU General Public License
Usage: logrotate [-dfv?] [-d|--debug] [-f|--force] [-m|--mail=command] [-s|--state=statefile]
[-v|--verbose] [-l|--log=logfile] [--version] [-?|--help] [--usage]
[OPTION...] <configfile>
root@83cab7e96087:/srv/www# ls -l var/log total 1730196 drwxr-xr-x 2 www-data www-data 119 Oct 28 10:14 apache -rw-r--r-- 1 www-data www-data 0 Oct 28 10:14 cron.log -rw-r--r-- 1 www-data www-data 2469 Oct 28 10:14 deploy.log -rw-rw-r-- 1 www-data www-data 2482255 Oct 31 09:16 itsm-cron-task.log -rw-rw-r-- 1 www-data www-data 23038 Oct 30 18:15 stg.appointment_elg_status_debug.log -rw-rw-r-- 1 www-data www-data 1661048 Oct 31 09:16 stg.coverage.log -rw-rw-r-- 1 www-data www-data 885351565 Oct 31 09:16 stg.log -rw-rw-r-- 1 www-data www-data 640533658 Oct 31 09:16 stg.mi7.log -rw-rw-r-- 1 www-data www-data 1320 Oct 31 06:21 stg.pod.log -rw-r--r-- 1 www-data www-data 14594 Oct 28 07:39 stg.proxy.log -rw-rw-r-- 1 www-data www-data 237840150 Oct 31 09:16 stg.proxy_mi7.log root@83cab7e96087:/srv/www# date Mon Oct 31 09:16:59 EDT 2022