You are here

public function SensorDblog404::buildQuery in Monitoring 7

Builds the database query.

Return value

\SelectQuery

Overrides SensorDatabaseAggregator::buildQuery

File

lib/Drupal/monitoring/Sensor/Sensors/SensorDblog404.php, line 21
Contains \Drupal\monitoring\Sensor\Sensors\SensorDblog404.

Class

SensorDblog404
Monitors 404 page errors from dblog.

Namespace

Drupal\monitoring\Sensor\Sensors

Code

public function buildQuery() {
  $query = parent::buildQuery();
  $query
    ->addField('watchdog', 'message');

  // The message is the requested 404 URL.
  $query
    ->groupBy('message');
  $query
    ->orderBy('records_count', 'DESC');
  $query
    ->range(0, 1);
  return $query;
}