cPanel/LogManager
cPanel module

LogManager

4 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="LogManager", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

delete_archive GET#

Delete a log archive file

Delete a specific log archive file from the authenticated user's ~/logs directory.

filestringRequired
The log archive filename to delete. Requirements: Must reside in the user's ~/logs directory. Must end with .gz. * Must not contain path traversal characters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

get_settings GET#

Retrieve cPanel account's log archival settings

This function retrieves the account's log archival settings.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

archive_logsinteger
Whether the system archives log files to your home directory. 1 — Archives the logs. 0 — Does not archive the logs.
One of: 1 0
prune_archiveinteger
Whether the system removes the previous month's archived log files from your home directory. 1 — Removes the logs. 0 — Does not remove the logs.
One of: 1 0
retention_daysinteger
The number of days the system retains archived log files before automatic removal. A value of 0 means the system retains logs indefinitely. When the user has not set a custom value, this returns the server-wide default.
using_defaultinteger
Whether the user uses the server-wide default retention period. 1 — Uses the server default. 0 — Uses a custom retention value.
One of: 1 0

list_archives GET#

Return cPanel account's archive files list

This function returns a list of the user's archive files.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

filestring
The archive file's name.
mtimeinteger
The archive file's last modified date.
pathstring
The archive file's path.

set_settings GET#

Save cPanel account's log archive settings

This function saves the account's log archive settings.

Note:

You must pass at least one of the archive_logs, prune_archive, or retention_days parameters.

archive_logsintegerOptional
Whether to archive log files to your home directory after the system processes statistics. 1 — Archive the logs. 0 — Do not archive the logs. Note: This parameter defaults to the archive-logs setting's value in the user's ~/.cpanel-logs file. If this file does not exist, this parameter defaults to the default_archive-logs key's value in the cpanel.config file.
prune_archiveintegerOptional
Whether to remove the previous month's archived logs from the ~/logs directory at the end of each month. 1 — Remove the logs. 0 — Do not remove the logs. Note: This parameter defaults to the remove-old-archived-logs setting's value in the user's ~/.cpanel-logs file. If this file doesn't exist, this parameter defaults to the default_remove-old-archive-logs key's value in the cpanel.config file.
retention_daysintegerOptional
The number of days to retain archived log files before automatic removal. 0 — Retain logs indefinitely. -1 — Clear the per-user override and revert to the server default. * Any positive integer — Retain logs for that many days. When not provided, the existing value is preserved.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.