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::list_archives - Developer Documentation - cPanel Documentation
Child pages
  • UAPI Functions - LogManager::list_archives
Skip to end of metadata
Go to start of metadata

Description

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

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess###########/execute/LogManager/list_archives


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.
 
// List all archive log files for the account.
$list_archvies = $cpanel->uapi(
    'LogManager', 'list_archives' 
);


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.
 
# List all archive log files for the account.
my $list_archives = $cpliveapi->uapi(
    'LogManager', 'list_archives',
);


Note:

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

 Command Line
uapi --user=username LogManager list_archives


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)
{  
   "status":1,
   "metadata":{  
	 "transformed": 1
   },
   "warnings":null,
   "messages":null,
   "data":[  
     {
      file: cptest.ninja-Jun-2019.gz
      mtime: '1561394253'
      path: /home/cptest/logs/cptest.ninja-Jun-2019.gz
     },	 
   ],
   "errors":null
}


Note:

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

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample

array of hashes

An array of hashes of archive files. These files reside in the /home/user/logs directory, where user represents the cPanel user.

Each array of hashes contains the mtime, path, and file returns.

mtime

integer

The archive file's last modified date.

The function returns this value in the unnamed array of hashes.

A valid date and time, in Unix time format.1557835866 

path

string

The archive file's path.

The function returns this value in the unnamed array of hashes.

A valid file path./home/user/logs/domain.com-May-2019.gz 

file

string

The archive file's name.

The function returns this value in the unnamed array of hashes.

A valid file name.domain.com-May-2019.gz