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

 

     [snips-users] FIX for logstats.pl parsing errors in snips-1.2beta

I just finally went through the code for snips-1.2beta logstats.pl to
try to isolate the parsing error... looks like there are three separate
small errors that contribute to the problem.  Trying to maintain the
sanctity of the code (ie. writing as few changes as possible), here are
the steps to fix it... for those more interested in a diff, it appears
at the bottom of this message.

List of changes:
  Around line 92 -
    The "if" statement has two problems:
     - The "or" for SITE and DEVICE needs to be grouped, else it's
       it's looking for "SITEEVICE" or "SITDEVICE" rather than "SITE"
       or "DEVICE"

       So... "SITE|DEVICE" becomes "(SITE|DEVICE)"

     - The NOCOP tag has become a STATE tag with the new log files.  So,
       that needs to bne changed as well

       So... "NOCOP" becomes "STATE"

  Around line 95 -
    The assignment statement now suffers a problem because of the first
    change we made... basically, all the variables get bumped out one,
    starting at the third... (so three becomes four, four becomes five,
    etc)

    So...

      "($1, $2, $3, $4, $5, $6, $7, $8, $9);"

    Becomes...

      "($1, $2, $4, $5, $6, $7, $8, $9, $10);"


That seems to fix my issues with the thing... hope it helps everyone
else with the parser.  Please use at your own risk, etc, and all that
normal nonsense...

Best Regards and Happy Holidays to all...
Russell



(for clarification... "<" is old... ">" is new)

-- begin

92c92
<   if ( /^(\w+\s+\w+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+\[([^]]+)\]:\s+SITE|DEVICE\s+(\S+)\s+(?:(\S+)\s+)?VAR\s+(\S+)\s+(\d+).*LEVEL\s+(\S+)\s+LOGLEVEL\s+(\S+)\s+NOCOP\s+(\S+)/ )
---
>   if ( /^(\w+\s+\w+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+\[([^]]+)\]:\s+(SITE|DEVICE)\s+(\S+)\s+(?:(\S+)\s+)?VAR\s+(\S+)\s+(\d+).*LEVEL\s+(\S+)\s+LOGLEVEL\s+(\S+)\s+STATE\s+(\S+)/ )
95c95
< 	$e_loglevel, $e_nocop) = ($1, $2, $3, $4, $5, $6, $7, $8, $9);
---
> 	$e_loglevel, $e_nocop) = ($1, $2, $4, $5, $6, $7, $8, $9, $10);

-- end



-- 
Russell M. Van Tassell
russell at loosenut com

"I love deadlines.  I especially like the whooshing sound they make as
 they go flying by."

Zyrion Traverse Network Monitoring & Network Management Software