Index: modules/search/search.admin.inc =================================================================== --- modules/search/search.admin.inc (revision 1452) +++ modules/search/search.admin.inc (working copy) @@ -130,6 +130,18 @@ '#options' => _search_get_module_names(), '#description' => t('Choose which search module is the default.') ); + + $form['logging'] = array( + '#type' => 'fieldset', + '#title' => t('Logging') + ); + $form['logging']['search_log_searches_to_watchdog'] = array( + '#type' => 'checkbox', + '#title' => t('Log searches to watchdog'), + '#default_value' => variable_get('search_log_searches_to_watchdog', 1), + '#description' => t('If checked all searches will be logged to watchdog.') + ); + $form['#validate'][] = 'search_admin_settings_validate'; $form['#submit'][] = 'search_admin_settings_submit'; Index: modules/search/search.pages.inc =================================================================== --- modules/search/search.pages.inc (revision 1452) +++ modules/search/search.pages.inc (working copy) @@ -59,8 +59,10 @@ } // Only search if there are keywords or non-empty conditions. if ($keys || !empty($conditions)) { - // Log the search keys. - watchdog('search', 'Searched %type for %keys.', array('%keys' => $keys, '%type' => $info['title']), WATCHDOG_NOTICE, l(t('results'), 'search/' . $info['path'] . '/' . $keys)); + if (variable_get('search_log_searches_to_watchdog', 1)) { + // Log the search keys. + watchdog('search', 'Searched %type for %keys.', array('%keys' => $keys, '%type' => $info['title']), WATCHDOG_NOTICE, l(t('results'), 'search/' . $info['path'] . '/' . $keys)); + } // Collect the search results. $results = search_data($keys, $info['module'], $conditions);