[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]

 

     Re: [snips-users] Web interface and device logging...

"Lightfoot, Kirk" <klightfoot at station sony.com> writes:

> I've been unable to make the date/timestamps appear in the Device Logs page
> of the web interface.
> Has anyone else had difficulty with this, or figured out how to fix it?

I encountered the same difficulty today.

It seems the problem is with the log-parsing regular expression in 
snipsweb.cgi.

/^(.*)\s+\[(.*)\]:\s+SITE|DEVICE\s+$devicename.*\s+$deviceaddr.*\s+VAR\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+LEVEL\s+(\S+)\s+/i

This regexp includes the alternation character '|' to allow for the
occurrence of both "SITE" and "DEVICE" -- unfortunately, at least with
any version of perl I've tried, this portion of the expression is
ambiguous because there are no delimiters to specify where the first
alternative begins.

To fix this I delimited the alternatives with parentheses.  As such
I needed to shift the positional variables (3 through 7) that follow.

I'm including a patch that works for me (snips 1.1).

Cheers,
Scott

--- snipsweb.cgi.orig   Tue Aug 28 19:20:12 2001
+++ snipsweb.cgi        Tue Aug 28 19:23:30 2001
@@ -495,6 +495,6 @@
   {
-    if ( /^(.*)\s+\[(.*)\]:\s+SITE|DEVICE\s+$devicename.*\s+$deviceaddr.*\s+VAR\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+LEVEL\s+(\S+)\s+/i )
+    if ( /^(.*)\s+\[(.*)\]:\s+(SITE|DEVICE)\s+$devicename.*\s+$deviceaddr.*\s+VAR\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+LEVEL\s+(\S+)\s+/i )
     {
       print "<TR bgcolor=\"$rowcolor[$cnt % 2]\"> \n";
-      foreach $str ($cnt, "$1", "$2", "$3", "$4", "$5", "$6", "$7") {
+      foreach $str ($cnt, "$1", "$2", "$4", "$5", "$6", "$7", "$8") {
        print "\t <td><font face=\"arial,helvetica\" size=\"2\"> $str </font> </td> \n";

Zyrion Traverse Network Monitoring & Network Management Software