function elasticsearch_watchdog_filters in Elasticsearch Connector 7
Same name and namespace in other branches
- 7.5 modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc \elasticsearch_watchdog_filters()
- 7.2 modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc \elasticsearch_watchdog_filters()
Creates a list of log administration filters that can be applied.
Return value
array Associative array of filters. The top-level keys are used as the form element names for the filters, and the values are arrays with the following elements:
- title: Title of the filter.
- where: The filter condition.
- options: Array of options for the select list for the filter.
3 calls to elasticsearch_watchdog_filters()
- elasticsearch_watchdog_build_filter_query in modules/
elasticsearch_watchdog/ elasticsearch_watchdog.admin.inc - Builds a filter for elasticsearch log administration filters based on session.
- elasticsearch_watchdog_filter_form in modules/
elasticsearch_watchdog/ elasticsearch_watchdog.admin.inc - Form constructor for the logging filter form.
- elasticsearch_watchdog_filter_form_submit in modules/
elasticsearch_watchdog/ elasticsearch_watchdog.admin.inc - Form submission handler for elasticsearch_watchdog_filter_form().
File
- modules/
elasticsearch_watchdog/ elasticsearch_watchdog.admin.inc, line 566 - Created on Jan 06, 2014
Code
function elasticsearch_watchdog_filters($load_options = TRUE) {
$filters = array();
$filters['full_massage'] = array(
'title' => t('Freetext'),
'elastic_key' => "full_massage",
'type' => 'textfield',
'options' => array(),
);
$types = array();
foreach (_elasticsearch_watchdog_get_facets('type', 'terms') as $key => $value) {
$types[$key] = t($value['key'] . ' (' . $value['doc_count'] . ')');
}
if (!empty($types) || $load_options == FALSE) {
$filters['type'] = array(
'title' => t('Type'),
'elastic_key' => "type",
'options' => $types,
);
}
$severities = array();
$basic_severity = watchdog_severity_levels();
foreach (_elasticsearch_watchdog_get_facets('severity', 'terms') as $key => $value) {
$severities[$key] = $basic_severity[$key] . ' (' . $value['doc_count'] . ')';
}
if (!empty($severities) || $load_options == FALSE) {
$filters['severity'] = array(
'title' => t('Severity'),
'elastic_key' => 'severity',
'options' => $severities,
);
}
$options = array();
foreach (_elasticsearch_watchdog_get_facets('domain', 'terms') as $key => $value) {
$options[$key] = t($value['key'] . ' (' . $value['doc_count'] . ')');
}
if (!empty($options) || $load_options == FALSE) {
$filters['domain'] = array(
'title' => t('Domain'),
'elastic_key' => "domain",
'options' => $options,
);
}
$options = array();
foreach (_elasticsearch_watchdog_get_facets('username', 'terms') as $key => $value) {
$options[$key] = t($value['key'] . ' (' . $value['doc_count'] . ')');
}
if (!empty($options) || $load_options == FALSE) {
$filters['username'] = array(
'title' => t('Username'),
'elastic_key' => "username",
'options' => $options,
);
}
return $filters;
}