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

Description

This function returns entries from a domain's error log.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Stats/get_site_errors?domain=example.com&log=suexec&maxlines=250


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.
 
// Retrieve the last 250 lines from example.com's error log.
$get_site_errors = $cpanel->uapi(
    'Stats', 'get_site_errors',
    array(
        'domain'    => 'example.com',
		'log'		=> 'suexec',
		'maxlines'  => '250',
  )
);


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.
 
# Retrieve the last 250 lines from example.com's error log.
my $list_sites = $cpliveapi->uapi(
    'Stats', 'get_site_errors',
    {
        'domain'   => 'example.com',
		'log'      => 'suexec',
		'maxlines' => '250',
    }
);


Note:

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

 

 Command Line
uapi --user=username Stats get_site_errors domain=example.com log=suexec maxlines=250 


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)
 {
      "data": {
            [
              {
                "entry" : "[Fri Feb 13 19:58:23.420593 2009] [core:error] [pid 29227:tid 47876185720576] (13)Permission denied: [client 10.0.0.2:62908] AH00132: file permissions deny server access: /home/user/public_html/index.html",
                "date" : 1234576703
              },
              {
                "entry" : "[Fri Feb 13 19:58:24.420593 2009] [core:error] [pid 29228:tid 47876185720577] (13)Permission denied: [client 10.0.0.2:62908] AH00132: file permissions deny server access: /home/user/public_html/index.html",
                "date" : 1234576704
              }
            ]
         },
      "errors": null,
      "messages": null,
      "metadata": {
         "transformed": 1
      },
      "status": 1,
      "warnings": null
  }


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain for which to return error log entries.

A valid domain on the cPanel account.example.com 
log string

The Apache log file to query.

This parameter defaults to error

  • error — The /var/log/apache2/error_log file.
  • suexec — The /var/log/apache2/suexec_log file.
suexec 
maxlines integer

The number of lines to retrieve from the error log.

This parameter defaults to 300.

An integer value between 1 and 5000.250 

Returns

ReturnTypeDescriptionPossible valuesExample
entry stringThe error log entry.A valid string.
 Click to view...
[Fri Feb 13 19:58:24.420593 2009] [core:error] [pid 29228:tid 47876185720577] (13)Permission denied: [client 10.0.0.2:62908] AH00132: file permissions deny server access: /home/user/public_html/index.html",
date integerThe date that the system recorded the error.A valid date, in Unix time format.1234576704