Our documentation is getting an overhaul! We would like your input! Click here to take a look at the beta launch of our new documentation site! Only cPanel & WHM version 82 documentation exists on our beta at this time. 84 will be added to the new site soon! Leave your feedback here: https://go.cpanel.net/docsfeedback
UAPI Functions - LogManager::set_settings - Developer Documentation - cPanel Documentation
Child pages
  • UAPI Functions - LogManager::set_settings
Skip to end of metadata
Go to start of metadata

Description

This function saves the account's log archive settings.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/LogManager/set_settings?archive_logs=1&prune_archive=1


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// Set example.com's log archive settings.
$set_settings = $cpanel->uapi(
    'LogManager', 'set_settings',
    array(
        'archive_logs'    => '1',
        'prune_archive'   => '1',
    )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Set example.com's log archive settings.
my $set_settings = $cpliveapi->uapi(
    'LogManager', 'set_settings',
    {
        'archive_logs'    => '1',
        'prune_archive'   => '1',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Set example.com's log archive settings. -->
[%
SET result = execute('LogManager', 'set_settings', {
    archive_logs  => '1',
    prune_archive => '1',
});
IF result.status %]
Saved successfully.
[% ELSE %]
ERROR: [% result.errors.0 %]
[% END %]


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username LogManager set_settings archive_logs=1 prune_archive=1


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{ 
   "metadata":{ 
 
   },
   "data":null,
   "status":1,
   "errors":null,
   "messages":null,
   "warnings":null
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

You must pass one of the following parameters. 


ParameterTypeDescriptionPossible valuesExample
archive_logs

Boolean

Whether to archive log files to your home directory after the system processes statistics.

This parameter defaults to the archive-logs setting's value in the user's ~/.cpanel-logs file.

If this file doesn't exist, this parameter defaults to the default_archive-logs key's value in the cpanel.config file.

  • 1 — Archive the logs.
  • 0 — Do not archive the logs.
1
prune_archiveBoolean

Whether to remove the previous month's archived logs from
the ~/logs directory at the end of each month.

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.

  • 1 — Remove the logs.
  • 0 — Do not remove the logs.
1

Returns

This function only returns metadata.