CVS edit link for Gomez_in_the_South

I would like a CVS account to contribute a module called Sentinel which extends the functionality of the watchdog module.

I believe that the module that we've developed is unique and does not offer functionality that is available in existing modules. I've looked at the Watchdog Live module amongst others. The Sentinel module can be downloaded from: http://www.springfisher.com/sentinel/sentinel-6.x-1.0-beta4.tar.gz .

Our application text is below. We have taken all the suggestions from our previous application into account and would like to resubmit it for evaluation.

Regarding the suggestion from Dave Reid that this module should be merged with the Logging and Alerts module. I have looked at that module, and whilst there is some overlapping functionality, I believe our module has a different focus. I will definitely keep aware of that module and consider collaborating with that author in the future.

We're using the Sentinel module in an existing site and it has been very useful for us. We believe it can be likewise useful for many others.

Regards,
George

Sentinel has the following key features:
- Group watchdog entries by type to allow an overview of the sites watchdog entries.
- Alert feature where certain watchdog events will trigger an e-mail to the administrator.
- Archival of existing watchdog entries on cron based on user specified filters
- Ajax used to enhance usability for navigation of watchdog entries

Example use cases:
1. Eric runs GuitarFeeds.com which has a lot of feeds to be updated and therefore runs cron every 5 minutes. This causes 288 entries of Cron run completed to appear in the watchdog table every day, or 8640 every month. Using the Sentinel module, Eric can set any entries matching the type 'cron' with the keywords 'completed' to be archived on a daily basis. This will reduce the 288 entries into a single watchdog entry where Eric can see the number of matching entries that were deleted.

2. Larry is running a high profile site that depends on the Apache solr module for search. Unfortunately he has been having stability issues with the Solr instance. Whilst the Solr module will post a warning to the watchdog table, Larry doesn't have the time to watch the Log entries page constantly. With the Sentinel module, Larry can be e-mailed whenever an 'Apache Solr' type of event occurs of severity 'error' or higher which he can respond to in a much more timely fashion.

The module can be downloaded from: http://www.springfisher.com/sentinel/sentinel-6.x-1.0-beta4.tar.gz

Please see the readme.txt included in the module for more information.

Comments

gomez_in_the_south’s picture

StatusFileSize
new16.9 KB

Please find the Sentinel module attached.

dave reid’s picture

I totally agree with point 1, but point 2 should really be in the logging and alerts module. I've been working on that feature for a while now, but needs some help.

avpaderno’s picture

Status: Postponed (maintainer needs more info) » Needs review
Issue tags: +Module review
avpaderno’s picture

As reported in the project page for Logging and alerts:

Email logging and alerts
Allows routing of watchdog messages to various email addresses, based on their severity levels. For example, emergency and critical messages need to go to a pager or mobile phone email address, while debug messages go no where.

IMO, there is an evident overlapping of functionalities.

gomez_in_the_south’s picture

I don't dispute that the Alert functionality is similar to that of the Logging and Alerts module. However the core of our module is the improved interface to the Watchdog Overview. The Archiving of the cron messages and the Alerts are extra features.

The way I see it, there are a few different options:
1. Publish the Sentinel module as it is. Keep in mind the possibility of doing #3 or #4 at a later stage.
2. Remove the Alerts feature from our Sentinel module to allow users to decide which functionalities they require and install either or both of the modules.
3. Include the extra functionalities from the Logging and Alerts module into the Sentinel.
4. Include the extra features of the Sentinel module into the Logging and Alerts modules.

I'm happy to discuss all of the above options. Dave, as a maintainer of the Logging and Alerts module, I'm open to your ideas on collaboration. I am quite eager to get the module available soon so I would lean towards #1 or #2.

avpaderno’s picture

IMO, the only solution is #2.

gomez_in_the_south’s picture

If Dave or others are in agreement then I will look to remove the Alerts functionality as per #2.

gomez_in_the_south’s picture

I'll be posting a version without the Alerts functionality shortly.

gomez_in_the_south’s picture

StatusFileSize
new14.5 KB

Please find a revised version attached without the alert functionality.

gomez_in_the_south’s picture

Is there any progress in my application for a CVS account?

(I hope that you have all enjoyed a great festive season and I wish you all the best for the New Year)

gomez_in_the_south’s picture

Do I need to submit a new application for a CVS account?

avpaderno’s picture

Do I need to submit a new application for a CVS account?

Why? This application has never been declined. You would not be able to submit a new application, and there is not any reason to do so.

gomez_in_the_south’s picture

Ok, I thought that perhaps it had expired in some form as I received no response to my messages #9 or #10.

Is there anything you still require from me to proceed with this?

gomez_in_the_south’s picture

What is the current status is with this application? An update would be appreciated - thanks.

gomez_in_the_south’s picture

Can this application be either approved or denied?

gomez_in_the_south’s picture

Hello? Is there any way I can get progress to be made on this?

avpaderno’s picture

Status: Needs review » Needs work
function sentinel_cron() {  
  $severity_words = watchdog_severity_levels();
  $cron_filters =sentinel_get_msg_filters('cron');   
   
  if (!empty($cron_filters)) {
   foreach ($cron_filters as $filter) {  
    $time = time()-$filter[SENTINEL_F_TIME];
    $last_update = $filter[SENTINEL_F_NEXT_UPDATE];      
    if (time() - $last_update >0 ) {
      $sentinel_cron_where = array();
      $sentinel_cron_where_values = array();
      $q = " SELECT count(*) as num FROM {watchdog}  WHERE ";      
      $message = t("Entries with ");
      if (strlen($filter[SENTINEL_F_TYPE])>0) {
        $sentinel_cron_where[] = "type IN ('%s')  AND ";
        $sentinel_cron_where_values[] = $filter[SENTINEL_F_TYPE];
        $message .= " <br> " . t("type") . ": " . $filter[SENTINEL_F_TYPE] ;
      }
      if (strlen($filter[SENTINEL_F_SEVERITY])>0) {        
        $sentinel_cron_where[] = "severity IN (%s)  AND ";
        $sentinel_cron_where_values[] = $filter[SENTINEL_F_SEVERITY];
        $sev_html = $filter[SENTINEL_F_SEVERITY];
        foreach ($severity_words as $key => $value) {
          $sev_html = str_replace($key, $value, $sev_html);
        }
         $message .= "<br> " . t("severity") . " : ". t($sev_html);  
      }
      if (strlen($filter[SENTINEL_F_USER])>0) {        
         $sentinel_cron_where[] = "uid IN (%s)  AND ";
         $sentinel_cron_where_values[] = $filter[SENTINEL_F_USER];
         $message .= "<br> " . t("user(s)") . " : ". $filter[SENTINEL_F_USER];  
      }
      if (strlen($filter[SENTINEL_F_KEYWORD])>0) {
        $sentinel_cron_where[] = " ( message LIKE \"%%%s%\"  OR  variables LIKE \"%%%s%\" ) AND";       
        $sentinel_cron_where_values[] = $filter[SENTINEL_F_KEYWORD];
        $sentinel_cron_where_values[] = $filter[SENTINEL_F_KEYWORD];        
         $message .= "<br> " .t("Keyword(s)") . " : ". $filter[SENTINEL_F_KEYWORD];  
      }
      if (strlen($filter[SENTINEL_F_RANGE])>2) {
        $range_arr = explode("and", $filter[SENTINEL_F_RANGE]);        
        $sentinel_cron_where[] = "timestamp BETWEEN %d AND %d ";
        $sentinel_cron_where_values[] = $range_arr[0];
        $sentinel_cron_where_values[] = $range_arr[1];      
        $message .= " <br> " . t("Between") ." : ". t(format_date($range_arr[0], 'small'));
        $message .= t("and") . " : ". format_date($range_arr[1], 'small');
      }else {
        $sentinel_cron_where[] = "timestamp < %d ";
        $sentinel_cron_where_values[] = $time;
        $message .= " <br> " . t("Older than") . " : ". format_date($time, 'small');  
      }
      $q = $q . ' ' . implode(' ',  $sentinel_cron_where);     
      $r = db_query(db_rewrite_sql($q), $sentinel_cron_where_values);      
      $results = db_fetch_object($r);
      if ($results->num>0) {
        $message .= "<br> Total number : ". $results->num;
        $query = "DELETE FROM {watchdog} WHERE ";        
        $query = $query .' '. implode(' ',  $sentinel_cron_where);
        
        //providing data for hook_sentinel before clearing
        $q_hook = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE";
         $q_hook = $q_hook . ' ' . implode(' ',  $sentinel_cron_where);
         $res_hook = db_query($q_hook, $sentinel_cron_where_values);
         $entries = array();
         while ( $data_hook = db_fetch_object($res_hook)) {
        
         $entries[]= $data_hook;
         }
         module_invoke_all('sentinel', $entries, count($cron_filters));        
               
        $res = db_query($query, $sentinel_cron_where_values);
        if (db_affected_rows()>0) {
          $n = db_affected_rows();
          watchdog('sentinel', t($message), NULL, $severity = WATCHDOG_NOTICE, NULL);
           $next_update = time()+ $filter[SENTINEL_F_TIME];         
          db_query("UPDATE {sentinel_filters} s set s.next_update = %d  WHERE s.fid = %d", $next_update, $filter[SENTINEL_F_ID]) ;
       }        
      
     }
    }
   }     
  }  
}

The second argument of watchdog() is a not translated string. Rather than concatenating the string that needs to be translated (even if it is translated from watchdog()), the string should use t()-placeholders.

The code should use the Drupal Unicode functions to handle strings.

if (strlen($object->name) <=0) {
      $users[$object->uid] = "Anonymous";
    }

The length of a string cannot be negative; the string Anonymous needs to be translated.

avpaderno’s picture

Status: Needs work » Closed (won't fix)

There have not been replies in the last week. I am marking this application as won't fix.