Development Guides Home >> Guide to Standardized Hooks >> Hookable Events
The Log::Retention category's events occur when you run the /usr/local/cpanel/scripts/log_retention script.
Note:
These events do not currently support custom user paths.
- Action code runs as:
root - Blocking attribute: Unavailable
- Escalate privileges attribute: N/A
pre— Hook action code runs before the script deletes files.post— Hook action code runs after the script deletes files.
Use this event to archive or backup files before the script removes them.
The pre_deletion event returns the following values:
| Return | Description | Example |
|---|---|---|
log_type | The type of logs to process. | web |
user | Username for user logs, or undef for system logs. | example |
base_path | The base directory to process. | /var/log/example-logs |
files_to_delete | Array reference of files to delete. | ['/var/log/example-logs/log.1.gz', '/var/log/example-logs/log.2.gz'] |
retention_days | Configured retention period in days. | 7 |
This event runs after the script deletes files.
The post_deletion event returns the following values:
| Return | Description | Example |
|---|---|---|
log_type | The type of logs processed. | web |
user | Username if processing user logs, or undef for system logs. | example |
base_path | Base directory processed. | /var/log/example-logs |
deleted_count | Number of files deleted. | 4 |
retention_days | Configured retention period in days. | 7 |