Kamis, 11 April 2019

How to clean catalina.out tomcat log without restart with truncate command

  Tidak ada komentar
Change working directory to apache tomcat folder
[root@simlalabim ~]# cd /opt/
[root@simlalabim opt]#
[root@simlalabim opt]# ls
apache-tomcat-7.0 Arcserve  jdk_oss  rh
[root@simlalabim opt]#
[root@simlalabim opt]# cd apache-tomcat-7.0/
[root@simlalabim apache-tomcat-7.0]#

Enter to apache tomcat logs folder
[root@simlalabim apache-tomcat-7.0]# cd logs/
[root@simlalabim logs]#
[root@simlalabim logs]# ls
Check the catalina.out log size and inode
[root@simlalabim logs]# ls -lshi | grep catalina.out
68311021  32G -rw-r--r--. 1 root root  32G Apr 12 13:07 catalina.out
[root@simlalabim logs]#
Perform truncate command
[root@simlalabim logs]# truncate -s 0 M catalina.out
[root@simlalabim logs]#
Check the catalina.out log size again, the size was become 0 and the inode still remain
[root@simlalabim logs]# ls -lshi catalina.out
68311021 0 -rw-r--r--. 1 root root 78K Apr 12 13:08 catalina.out
[root@simlalabim logs]#

Tidak ada komentar :

Posting Komentar