You are here

function acquia_spi_get_watchdog_data in Acquia Connector 7.2

Same name and namespace in other branches
  1. 6.2 acquia_spi/acquia_spi.module \acquia_spi_get_watchdog_data()
  2. 7.3 acquia_spi/acquia_spi.module \acquia_spi_get_watchdog_data()

Get the latest (last hour) critical and emergency warnings from watchdog These errors are 'severity' 0 and 2.

Parameters

n/a:

Return value

array

1 call to acquia_spi_get_watchdog_data()
acquia_spi_get in acquia_spi/acquia_spi.module
Gather site profile information about this site.

File

acquia_spi/acquia_spi.module, line 1147
Send site profile information (NSPI) and system data to Acquia Insight.

Code

function acquia_spi_get_watchdog_data() {
  $wd = array();
  if (module_exists('dblog')) {
    $result = db_select('watchdog', 'w')
      ->fields('w', array(
      'wid',
      'severity',
      'type',
      'message',
      'timestamp',
    ))
      ->condition('w.severity', array(
      WATCHDOG_EMERGENCY,
      WATCHDOG_CRITICAL,
    ), 'IN')
      ->condition('w.timestamp', REQUEST_TIME - 3600, '>')
      ->execute();
    while ($record = $result
      ->fetchAssoc()) {
      $wd[$record['severity']] = $record;
    }
  }
  return $wd;
}