I tried to configure my logrotate.d as below, it generates files with funny names (ex: 0220420-20220421-20220422-20220423-20220424-20220425-20220426), I want to check is it working as expected since it is my first experience? As I am not sure why it creates files with zero sizes?
My expectation was:
- rotate 7 times
- per day
- missing okay
- notifempty
- compress the files
- max size of the file shouldn’t be more than 50MB
- max age of files shouldn’t be more than 100 days
My config file in /etc/logrotate.d/myconfig is as below. Did I configure my configuration properly and the naming is correctly generated?
/data/meter-logs/messages_*[!.gz]
{
rotate 7
daily
missingok
notifempty
compress
maxsize 50M
maxage 100
postrotate
syslog-ng-ctl reload > /dev/null
endscript
}
my files is **/data/meter-logs/** folder:
-rw-r--r-- 1 root root 3.5K Apr 26 19:28 messages_electricity_meter-dev
-rw-r--r-- 1 root root 0 Apr 21 03:34 messages_electricity_meter-dev-20220420
-rw-r--r-- 1 root root 0 Apr 22 03:42 messages_electricity_meter-dev-20220420-20220421
-rw-r--r-- 1 root root 0 Apr 23 03:17 messages_electricity_meter-dev-20220420-20220421-20220422
-rw-r--r-- 1 root root 0 Apr 24 03:46 messages_electricity_meter-dev-20220420-20220421-20220422-20220423
-rw-r--r-- 1 root root 0 Apr 25 03:15 messages_electricity_meter-dev-20220420-20220421-20220422-20220423-20220424
-rw-r--r-- 1 root root 0 Apr 26 03:45 messages_electricity_meter-dev-20220420-20220421-20220422-20220423-20220424-20220425
-rw-r--r-- 1 root root 83M Apr 20 03:28 messages_electricity_meter-dev-20220420-20220421-20220422-20220423-20220424-20220425-20220426
-rw-r--r-- 1 root root 0 Apr 23 03:17 messages_electricity_meter-dev-20220421
-rw-r--r-- 1 root root 0 Apr 25 03:15 messages_electricity_meter-dev-20220421-20220423
-rw-r--r-- 1 root root 12K Apr 21 03:28 messages_electricity_meter-dev-20220421-20220423-20220425
-rw-r--r-- 1 root root 0 Apr 24 03:46 messages_electricity_meter-dev-20220422
-rw-r--r-- 1 root root 0 Apr 26 03:45 messages_electricity_meter-dev-20220422-20220424
-rw-r--r-- 1 root root 5.3K Apr 22 03:28 messages_electricity_meter-dev-20220422-20220424-20220426
-rw-r--r-- 1 root root 0 Apr 25 03:15 messages_electricity_meter-dev-20220423
-rw-r--r-- 1 root root 5.1K Apr 23 02:28 messages_electricity_meter-dev-20220423-20220425
-rw-r--r-- 1 root root 0 Apr 26 03:45 messages_electricity_meter-dev-20220424
-rw-r--r-- 1 root root 5.5K Apr 24 03:28 messages_electricity_meter-dev-20220424-20220426
-rw-r--r-- 1 root root 5.1K Apr 25 02:28 messages_electricity_meter-dev-20220425
-rw-r--r-- 1 root root 5.5K Apr 26 03:28 messages_electricity_meter-dev-20220426
-rw-r--r-- 1 root root 0 Apr 20 03:34 messages_electricity_meter-test
-rw-r--r-- 1 root root 0 Apr 21 03:34 messages_electricity_meter-test-20220420
-rw-r--r-- 1 root root 0 Apr 22 03:42 messages_electricity_meter-test-20220420-20220421
-rw-r--r-- 1 root root 0 Apr 23 03:17 messages_electricity_meter-test-20220420-20220421-20220422
-rw-r--r-- 1 root root 0 Apr 24 03:46 messages_electricity_meter-test-20220420-20220421-20220422-20220423
-rw-r--r-- 1 root root 0 Apr 25 03:15 messages_electricity_meter-test-20220420-20220421-20220422-20220423-20220424
-rw-r--r-- 1 root root 0 Apr 26 03:45 messages_electricity_meter-test-20220420-20220421-20220422-20220423-20220424-20220425
-rw-r--r-- 1 root root 1.4G Apr 3 05:03 messages_electricity_meter-test-20220420-20220421-20220422-20220423-20220424-20220425-20220426