I saw the size directive and created the configuration file /etc/logrotate.d/test:
/home/user/log1 {
size 100
rotate 3
compress
}
but it doesn't work as I expect. The file should be rotated when its size becomes more than 100 bytes, and this does not happen. Nothing happens when the file size exceeds the limit, the file is not rotated, a new archive with the old log1 file is not created
Is it possible to achieve this behavior with logrotate?
OS is ubuntu 20
logrotateis not a daemon that runs in the background and is able to react when the file grows. It's a program run from cron, anacron or systemd, usually once a day. To see if your config works, you need to wait untillogrotateruns; or you need to start it manually, it will do its job and will exit.