Since API version 26.0.1, you can register an external_log manager to notify the app to clean up and delete external_log files when a fault log sandbox directory reaches its capacity threshold.
external_log specifies the path of a fault log file in the app sandbox. After an app subscribes to a system event through HiAppEvent, the event parameter object params contains an external_log field when that event occurs. You can read the fault log file using this path.
A system event supports multiple subscribers. Each subscriber receives a different external_log path so that its operations do not affect other subscribers. Only the first 100 subscribers receive independent log paths; subsequent subscribers share the same log path.
Choose either the ArkTS or C/C++ APIs to register an external_log manager as needed.
An app subscribes to a system event to obtain the external_log fault log content when that event occurs. The following figure shows how this works:

The detailed procedure is as follows:
The external_log directories include /data/storage/el2/log/hiappevent, /data/storage/el2/log/watchdog, and /data/storage/el2/log/resourcelimit.
For log specifications, see System Event Fault Log Directory Specifications.
The capacity thresholds for the sandbox fault log directories are as follows:
The app is notified to clean up and delete external_log files when /data/storage/el2/log/hiappevent/ reaches 4 MB.
The app is notified to clean up and delete external_log files when /data/storage/el2/log/resourcelimit/ reaches 1500 MB.