diff --git a/modules/dblog/dblog.install b/modules/dblog/dblog.install
index 759c7bc..4a2b5f3 100644
--- a/modules/dblog/dblog.install
+++ b/modules/dblog/dblog.install
@@ -84,6 +84,7 @@ function dblog_schema() {
     'primary key' => array('wid'),
     'indexes' => array(
       'type' => array('type'),
+      'severity' => array('severity'),
       'uid' => array('uid'),
     ),
   );
@@ -96,6 +97,9 @@ function dblog_schema() {
  */
 function dblog_uninstall() {
   variable_del('dblog_row_limit');
+  variable_del('dblog_allowed_severity');
+  variable_del('dblog_allowed_types');
+  variable_del('dblog_known_types');
 }
 
 /**
@@ -140,3 +144,10 @@ function dblog_update_7001() {
 /**
  * @} End of "addtogroup updates-6.x-to-7.x"
  */
+
+/**
+ * Implements hook_update_N().
+ */
+function dblog_update_7101() {
+  db_add_index('watchdog', 'severity', array('severity'));
+}
\ No newline at end of file
diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module
index 496a043..c795dd6 100644
--- a/modules/dblog/dblog.module
+++ b/modules/dblog/dblog.module
@@ -138,13 +138,44 @@ function _dblog_get_message_types() {
  * Note some values may be truncated for database column size restrictions.
  */
 function dblog_watchdog(array $log_entry) {
+  
+  // Ensure the type is trimmed to fit in the db column
+  $type = substr($log_entry['type'], 0, 64);
+  
+  // Check the severity filter to see if this message is allowed
+  $allowed_severity = variable_get('dblog_allowed_severity', array(0,1,2,3,4,5,6,7));
+  if (!in_array($log_entry['severity'], $allowed_severity)) {
+    return FALSE;
+  }
+  
+  // Load up the known types as well as the allowed types
+  $known_types = variable_get('dblog_known_types', array());
+  $allowed_types = variable_get('dblog_allowed_types', array());
+  
+  // If this is a new type, we allow it and we add it to the lists
+  if (!in_array($type, $known_types)) {
+    
+    // Add to our known types list.
+    $known_types[$type] = $type; 
+    variable_set('dblog_known_types', $known_types);
+    
+    // New types are allowed by default.
+    $allowed_types[] = $type;
+    variable_set('dblog_allowed_types', $allowed_types);
+  }
+
+  // If this is not an allowed type we don't log it
+  if (!in_array($type, $allowed_types)) {
+    return FALSE;
+  }
+  
   // The user object may not exist in all conditions, so 0 is substituted if needed.
   $user_uid = isset($log_entry['user']->uid) ? $log_entry['user']->uid : 0;
 
   Database::getConnection('default', 'default')->insert('watchdog')
     ->fields(array(
       'uid' => $user_uid,
-      'type' => substr($log_entry['type'], 0, 64),
+      'type' => $type,
       'message' => $log_entry['message'],
       'variables' => serialize($log_entry['variables']),
       'severity' => $log_entry['severity'],
@@ -168,6 +199,22 @@ function dblog_form_system_logging_settings_alter(&$form, $form_state) {
     '#options' => array(0 => t('All')) + drupal_map_assoc(array(100, 1000, 10000, 100000, 1000000)),
     '#description' => t('The maximum number of messages to keep in the database log. Requires a <a href="@cron">cron maintenance task</a>.', array('@cron' => url('admin/reports/status')))
   );
+  $form['dblog_allowed_types'] = array(
+    '#type' => 'select',
+    '#multiple' => TRUE,
+    '#title' => t('Allowed message types'),
+    '#default_value' => array_values(variable_get('dblog_allowed_types', array())),
+    '#options' => variable_get('dblog_known_types', array()),
+    '#description' => t('The message types which will be logged. Any new message types will be logged unless they are deselected.')
+  );
+  $form['dblog_allowed_severities'] = array(
+    '#type' => 'select',
+    '#multiple' => TRUE,
+    '#title' => t('Allowed message severities'),
+    '#default_value' => variable_get('dblog_allowed_severities', array(0,1,2,3,4,5,6,7)),
+    '#options' => watchdog_severity_levels(),
+    '#description' => t('Severities that will be logged. Deselect lower level severities to decrease database load.')
+  );
   $form['actions']['#weight'] = 1;
 }
 
