Current implementations of logrotate restrict the location of the destination directory to be on the same file system as the files being rotated out. This is purely for implementation simplicity - a hard link is used. However, it makes it difficult to use when the main log files live in ramdisk and one wants to preserve them in FLASH. Given that in many cases the logs are compressed as they are being rotated, using hard links doesn't buy much anyway.
Hi Gary, I think this is because the logrotate uses: rename(const char *oldpath, const char *newpath); to rotate the log, the rename can't acrosses the different filesystems, I will use read and write to replace the rename if you are OK with it, and will send the patch review next week after enough testing.
Fixed in http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d7663ff7ab2e5ef5c913befad5e0adfbd6cc22a2
verified it on : git info:6bd23e0faf329f086bb4885991ce5f5d095dac56 git branch: poky/master use following steps: 1. set build env,run "source ./oe-init-build-env builddir". 2. add lines to the conf/local.conf of builddir. DISTRO_EXTRA_RDEPENDS += "logrotate" 3. run "bitbake core-image-sato". 4. boot up image and add following configuration option to "/etc/logroate.conf": ... /var/log/wtmp { monthly create 0664 root utmp minsize 1M olddir /home/root/logrotate_dir rotate 1 } ... and "/home/root" is on different filesystem to which "/var/log/wtmp" is on. 5. run "logrotate -f /etc/logrotate.conf". wtmp-20120312 is found in /home/root/logrotate_dir. test env: host : ubuntu 11.10 x86_64 kernel : 3.0.0-16-generic #29-Ubuntu SMP