This topic describes FAQ about the log clearance mechanism for applications deployed in an Elastic Compute Service (ECS) cluster.

Are the logs of applications deployed in Enterprise Distributed Application Service (EDAS) regularly cleared?

The regular log clearance script in EDAS clears logs from the Ali-Tomcat log directory only when an application runs in the EDAS-Container x.x.x environment and is deployed in an ECS cluster by using a WAR package, in which case Ali-Tomcat is used. The directory from which logs are cleared may be other directories as well. The directory shown in the regular clearance task at 03:10 a.m. every day prevails. You can view the directory by running crontab -l on the ECS instance where the application is deployed. The following code shows an example of the command output.

[admin@iZbp1bzvz55uz2x8s0bhhcZ ~]$ crontab -l
10 3 * * * /home/admin/edas-agent/bin/rotator.sh
			

Currently, the regular log clearance script does not clear the following logs: logs of ECS applications that do not run in the EDAS Container x.x.x environment, logs of applications deployed in Swarm clusters and Container Service Kubernetes clusters, and Tomcat logs that may be generated.

What are the directories from which the regular log clearance script in EDAS clears logs? What are the log clearance rules?

  • The regular log clearance script clears log files that contain the keywords "log" and "out" and are located in /home/admin/taobao-tomcat*/, larger than 1 KB, and last modified more than seven days ago. In addition, the /home/admin/taobao-tomcat*/catalina.out file is polled.
  • The regular log clearance script clears log files that contain the keyword "log" and are located in /home/admin/configclient/, larger than 1 KB, and last modified more than seven days ago.
  • The regular log clearance script clears log files that contain the keyword "log" and are located in /home/admin/logs/diamond-client/, larger than 1 KB, and last modified more than seven days ago.
  • The regular log clearance script clears log files that are located in /home/admin/logs/ (including sub-directories), suffixed with .log, and larger than 500 MB when the number of these log files is greater than three and these log files are last modified more than seven days ago.

What can I do when the regular log clearance script in EDAS cannot meet my requirements or a lot of logs are still generated?

  • Ali-Tomcat is customized based on Apache Tomcat and is consistent with Apache Tomcat in terms of logging. It is better that applications deployed in EDAS do not write a large number of logs to Tomcat's log file catalina.out, regardless of whether the applications run in EDAS-Container x.x.x (which contains Ali-Tomcat) or Apache Tomcat. Alternatively, you can output custom logs of applications to Tomcat's log directory $CATALINA_HOME/logs. However, frequent writes to this directory may exhaust the disk space corresponding to the mount point directory /home of the ECS instance.
  • We recommend that you use the built-in Java logging framework or an open-source log framework in an application to manage the application's logs, and use the logging framework to poll application logs or control the number and size of stored application log files to avoid the disk space from being exhausted by excessive log writes.