This topic provides answers to frequently asked questions (FAQ) about the log cleanup policy for applications deployed in Enterprise Distributed Application Service (EDAS).
Are the logs of applications deployed in EDAS cleaned up on a regular basis?
The regular log cleanup script in EDAS cleans up 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 Elastic Compute Service (ECS) cluster by using a WAR package,
in which case Ali-Tomcat is used. The directory from which logs are cleaned up may
vary. The directory shown in the regular cleanup task at 03:10 every day prevails.
You can view the directory by running the
crontab -l command on the ECS instance where the application is deployed. The following code
shows an example of the command output:
[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 deployed in Swarm clusters and 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 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 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 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 when the number of these log files is greater than three.
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 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.