All Products
Search
Document Center

Enterprise Distributed Application Service:What is the log cleanup policy for applications that are deployed in an ECS cluster?

Last Updated:May 09, 2023

This topic provides answers to frequently asked questions (FAQ) about the log cleanup policy for applications that are deployed in Enterprise Distributed Application Service (EDAS).

Are the logs of applications that are deployed in EDAS cleaned up on a regular basis?

The regular log cleanup script in EDAS cleans up logs from the Ali-Tomcat directory only if the following conditions are met:

  • Applications are deployed in an Elastic Compute Service (ECS) cluster.
  • Applications run in the EDAS-Container x.x.x environment.
  • Applications are deployed by using a WAR package (in this case, Ali-Tomcat is used).

On the ECS instance where an application is deployed in an ECS cluster, you can run the crontab -l command as an administrator to view the regular cleanup task at 03:10 every day.

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

The regular log cleanup script does not clean up the following logs: logs of applications that are deployed in ECS clusters but do not run in the EDAS-Container x.x.x environment, logs of applications that are deployed in Swarm clusters or Container Service for Kubernetes (ACK) clusters, and Tomcat logs that may be generated.

What are the directories from which the regular log cleanup script in EDAS cleans up logs? What are the log cleanup rules?

  • The regular log cleanup script cleans up the log files that contain the log and out keywords and are stored in the /home/admin/taobao-tomcat*/ directory, larger than 1 KB, and last modified more than five days ago. In addition, the /home/admin/taobao-tomcat*/catalina.out file is polled.
  • The regular log cleanup script cleans up the log files that contain the log keyword and are stored in the /home/admin/configclient/ directory, larger than 1 KB, and last modified more than seven days ago.
  • The regular log cleanup script cleans up the log files that contain the log keyword and are stored in the /home/admin/logs/diamond-client/ directory, larger than 1 KB, and last modified more than seven days ago.
  • The regular log cleanup script cleans up earlier log files that are stored in the /home/admin/logs/ directory including subdirectories, suffixed with .log, and larger than 500 MB if the number of these log files is greater than three.
Note To control the log retention period, you can save logs to Log Service. You can set the log retention period by using a Logstore in Log Service. For more information, see Configure log collection.

What can I do if the regular log cleanup 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. We recommend that applications that are deployed in EDAS do not write a large number of logs to the log file catalina.out of Tomcat, regardless of whether the applications run in the EDAS-Container x.x.x environment that contains Ali-Tomcat or run in Apache Tomcat. Alternatively, you can specify the log directory $CATALINA_HOME/logs of Tomcat as the log directory for the custom logs of applications. However, frequent writes to this directory may exhaust the disk space that corresponds to the mount target directory /home on relevant ECS instances.

We recommend that you use the built-in Java logging framework or an open source logging framework in an application to manage the logs of the application, and use the logging framework to poll application logs or control the number and size of stored application log files to prevent the disk space from being exhausted by excessive log writes.