New answers tagged logrotate
Here's one way. [root@localhost tmp]# ls -lh log.txt -rw-r--r--. 1 root root 601M Jun 30 15:21 log.txt [root@localhost tmp]# tail --bytes=1048576 log.txt >log.txt.tmp [root@localhost tmp]# mv log.txt.tmp log.txt [root@localhost tmp]# ls -lh log.txt -rw-r--r--. 1 root root 1.0M Jul 1 01:35 log.txt [root@localhost tmp]#
The post rotate action appears to be incorrect Try invoke-rc.d nginx reload >/dev/null 2>&1 If you look at the nginix command you will see the actions it will accept. Also the message you got says check initctl --help xtian@fujiu1404:~/tmp$ initctl help Job commands: start Start job. stop Stop ...
To keep log files for 8 months you would need to use the maxage parameter, with a parameter that counts in days. Strictly it's not possible to keep log files for exactly 8 months, but the approximation of 243 days might be acceptable. As far as I have ever been able to tell, the difference between rotate and maxage is that rotate keeps N log files ...
Top 50 recent answers are included