public function UserFailedLoginsSensorPlugin::verboseResultCounting in Monitoring 8
Get the verbose results of the attempts per user.
Parameters
array $output: The output array, at which we will add the attempts per user result.
1 call to UserFailedLoginsSensorPlugin::verboseResultCounting()
- UserFailedLoginsSensorPlugin::resultVerbose in src/
Plugin/ monitoring/ SensorPlugin/ UserFailedLoginsSensorPlugin.php - Provide additional info about sensor call.
File
- src/
Plugin/ monitoring/ SensorPlugin/ UserFailedLoginsSensorPlugin.php, line 70 - Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\UserFailedLoginsSensorPlugin.
Class
- UserFailedLoginsSensorPlugin
- Monitors user failed login from dblog messages.
Namespace
Drupal\monitoring\Plugin\monitoring\SensorPluginCode
public function verboseResultCounting(array &$output) {
if ($this->sensorConfig
->getSetting('verbose_fields')) {
// Fetch the last 20 matching entries, aggregated.
$query = $this
->getAggregateQuery();
$query_result = $query
->range(0, 20)
->execute();
$this->queryString = $query_result
->getQueryString();
$rows = $this
->buildTableRows($query_result
->fetchAll());
$results = [];
foreach ($rows as $key => $row) {
$results[$key] = [];
$variables = unserialize($row['variables']);
$results[$key]['user'] = $variables['%user'];
$results[$key]['attempts'] = $row['records_count'];
}
$output['attempts_per_user'] = array(
'#type' => 'verbose_table_result',
'#title' => t('Attempts per user'),
'#header' => $this
->buildTableHeader($results),
'#rows' => $results,
'#query' => $query_result
->getQueryString(),
'#query_args' => $query
->getArguments(),
);
}
}