logrotate config file only specify the rules logrotate applies when running against the logfiles you specified.
You also need to add your logrotate execution line to your cronjob.
Adding cronjob as root(cronjob is based on different user!):
sudo su
crontab -e # <==== this will open an editor for you to edit your cronjobs, for root user
In the editor, you add an entry like this:
*/5 * * * * logrotate '/etc/logrotate.d/configname'
The "*/5 * * * " part is cron expression, it means executes every 5minutes, you need to change this to something make sense for you. In testing things out, you can set it to "/1 * * * *" and you can monitor on cron's log to see it actually happens.
Resource for cron: https://crontab.guru/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…