Changeset 263


Ignore:
Timestamp:
04/13/10 23:47:25 (22 months ago)
Author:
mickem
Message:

2010-04-09 MickeM

+ Added support for dates in the new CheckEventLog so the following are equvivalent:

CheckEventLog debug=true file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated lt -2d AND severity = 'error'" truncate=800 unique descriptions "syntax=%severity%: %source%: %strings% (%count%)"
CheckEventLog debug=true file=application file=system filter=new filter=in MaxWarn=1 MaxCrit=1 filter+generated=gt:2d filter+severity==error truncate=800 unique descriptions "syntax=%severity%: %source%: %strings% (%count%)" debug-threshold=100

Location:
branches/stable
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/AutoBuild.h

    r262 r263  
    33// change the FALSE to TRUE for autoincrement of build number 
    44#define INCREMENT_VERSION TRUE 
    5 #define FILEVER        0,3,8,33 
    6 #define PRODUCTVER     0,3,8,33 
    7 #define STRFILEVER     _T("0.3.8.33") 
    8 #define STRPRODUCTVER  _T("0.3.8.33") 
    9 #define STRPRODUCTDATE  _T("2010-04-08") 
     5#define FILEVER        0,3,8,41 
     6#define PRODUCTVER     0,3,8,41 
     7#define STRFILEVER     _T("0.3.8.41") 
     8#define STRPRODUCTVER  _T("0.3.8.41") 
     9#define STRPRODUCTDATE  _T("2010-04-13") 
    1010#endif // AUTOBUILD_H 
  • branches/stable/changelog

    r262 r263  
    66 * Fix depend onservice LanManWorkStation (old win) 
    77 * Fix RtlStringFromGUID problem on NT4 
     8 
     92010-04-09 MickeM 
     10 + Added support for dates in the new CheckEventLog so the following are equvivalent: 
     11    CheckEventLog debug=true file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated lt -2d AND severity = 'error'" truncate=800 unique descriptions "syntax=%severity%: %source%: %strings% (%count%)" 
     12    CheckEventLog debug=true file=application file=system filter=new filter=in MaxWarn=1 MaxCrit=1 filter+generated=gt:2d filter+severity==error truncate=800 unique descriptions "syntax=%severity%: %source%: %strings% (%count%)" debug-threshold=100 
     13 
     142010-04-09 MickeM 
     15 + Added "like" keyword to comapre strings like so: 
     16    "filter=severity = 'error' AND strings like 'SQLEXPRESS'" 
     17    CheckEventLog debug=true file=application file=system MaxWarn=1 MaxCrit=1 "filter=severity = 'error' AND strings like 'SQLEXPRESS'" truncate=800 unique descriptions "syntax=%severity%: %source%: %strings% (%count%)" 
     18 * Fixed eventlog check issue (Reverted "major eventlog change" since it did in fact break to many things) 
    819 
    9202010-04-04 MickeM 
  • branches/stable/include/parsers/ast.cpp

    r262 r263  
    1515#include <parsers/ast.hpp> 
    1616 
     17#include <simple_timer.hpp> 
    1718 
    1819namespace parsers { 
    1920  namespace where { 
    20  
    21  
    2221 
    2322    template<typename THandler> 
     
    8483 
    8584      bool operator()(unary_fun<THandler> & expr) { 
    86         //expr.subject.force_type(type); 
     85        if (expr.is_transparent(type)) 
     86          expr.subject.force_type(type); 
    8787        return true; 
    8888      } 
     
    105105    template<typename THandler> 
    106106    void expression_ast<THandler>::force_type(value_type newtype) { 
     107      std::wcout << _T("Forcing type: ") << type_to_string(type) << _T(" to ") << type_to_string(newtype) << _T(" for ") << to_string() << std::endl; 
    107108      if (type == newtype) 
    108109        return; 
     
    153154 
    154155      void operator()(unary_fun<THandler> const& expr) { 
    155         result << _T("fun:") << expr.name << _T("("); 
     156        result << _T("fun:") << (expr.is_bound()?_T("bound:"):_T("")) << expr.name << _T("("); 
    156157        operator()(expr.subject); 
    157158        //boost::apply_visitor(*this, expr.subject.expr); 
     
    195196 
    196197      THandler &handler; 
    197       visitor_get_int(THandler &handler) : handler(handler) {} 
     198      value_type type; 
     199      visitor_get_int(value_type  type, THandler &handler) : type(type), handler(handler) {} 
    198200 
    199201      long long operator()(expression_ast<THandler> const& ast) { 
    200         std::wcout << _T("GET INT: ") << ast.to_string() << std::endl; 
    201202        return boost::apply_visitor(*this, ast.expr); 
    202203      } 
     
    208209      } 
    209210      long long operator()(unary_fun<THandler> const& expr) { 
    210         return expr.evaluate(type_int, handler).get_int(handler); 
     211        return expr.evaluate(type, handler).get_int(handler); 
    211212      } 
    212213      long long operator()(list_value<THandler> const& expr) { 
     
    230231    template<typename THandler> 
    231232    long long expression_ast<THandler>::get_int(THandler &handler) const { 
    232       visitor_get_int<THandler> visitor(handler); 
     233      visitor_get_int<THandler> visitor(type, handler); 
    233234      return boost::apply_visitor(visitor, expr); 
    234235    } 
     
    309310    } 
    310311 
     312 
     313    template<typename THandler> 
     314    struct visitor_can_evaluate { 
     315      typedef bool result_type; 
     316 
     317      visitor_can_evaluate() {} 
     318 
     319      bool operator()(expression_ast<THandler> const& ast) { 
     320        return true; 
     321      } 
     322      bool operator()(binary_op<THandler> const& expr) { 
     323        return true; 
     324      } 
     325      bool operator()(unary_op<THandler> const& expr) { 
     326        return true; 
     327      } 
     328      bool operator()(unary_fun<THandler> const& expr) { 
     329        return true; 
     330      } 
     331      bool operator()(list_value<THandler> const& expr) { 
     332        return false; 
     333      } 
     334      bool operator()(string_value const& expr) { 
     335        return false; 
     336      } 
     337      bool operator()(int_value const& expr) { 
     338        return false; 
     339      } 
     340      bool operator()(variable<THandler> const& expr) { 
     341        return false; 
     342      } 
     343      bool operator()(nil const& expr) { 
     344        return false; 
     345      } 
     346    }; 
    311347    template<typename THandler> 
    312348    bool expression_ast<THandler>::can_evaluate() const { 
    313       if (boost::get<binary_op<THandler> >(&expr)) 
    314         return true; 
    315       if (boost::get<unary_op<THandler> >(&expr)) 
    316         return true; 
    317       if (boost::get<unary_fun<THandler> >(&expr)) 
    318         return true; 
    319       if (boost::get<expression_ast<THandler> >(&expr)) 
    320         return true; 
    321       return false; 
    322     } 
     349      visitor_can_evaluate<THandler> visitor; 
     350      return boost::apply_visitor(visitor, expr); 
     351    } 
     352 
     353    template<typename THandler> 
     354    struct visitor_evaluate { 
     355      typedef expression_ast<THandler> result_type; 
     356 
     357      THandler &handler; 
     358      value_type type; 
     359      visitor_evaluate(THandler &handler, value_type type) : handler(handler), type(type) {} 
     360 
     361      expression_ast<THandler> operator()(expression_ast<THandler> const& ast) { 
     362        return ast.evaluate(handler); 
     363      } 
     364      expression_ast<THandler> operator()(binary_op<THandler> const& op) { 
     365        return op.evaluate(handler); 
     366      } 
     367      expression_ast<THandler> operator()(unary_op<THandler> const& op) { 
     368        return op.evaluate(handler); 
     369      } 
     370      expression_ast<THandler> operator()(unary_fun<THandler> const& fun) { 
     371        return fun.evaluate(type, handler); 
     372      } 
     373      expression_ast<THandler> operator()(list_value<THandler> const& expr) { 
     374        return expression_ast<THandler>(int_value(FALSE)); 
     375      } 
     376      expression_ast<THandler> operator()(string_value const& expr) { 
     377        return expression_ast<THandler>(int_value(FALSE)); 
     378      } 
     379      expression_ast<THandler> operator()(int_value const& expr) { 
     380        return expression_ast<THandler>(int_value(FALSE)); 
     381      } 
     382      expression_ast<THandler> operator()(variable<THandler> const& expr) { 
     383        return expression_ast<THandler>(int_value(FALSE)); 
     384      } 
     385      expression_ast<THandler> operator()(nil const& expr) { 
     386        return expression_ast<THandler>(int_value(FALSE)); 
     387      } 
     388    }; 
     389 
    323390    template<typename THandler> 
    324391    expression_ast<THandler> expression_ast<THandler>::evaluate(THandler &handler) const { 
     392      visitor_evaluate<THandler> visitor(handler, get_type()); 
     393      return boost::apply_visitor(visitor, expr); 
     394      //simple_timer timer(to_string(), true); 
     395      /* 
    325396      if (const binary_op<THandler> *op = boost::get<binary_op<THandler> >(&expr)) 
    326397        return op->evaluate(handler); 
     
    332403        return ast->evaluate(handler); 
    333404      return *this; 
     405      */ 
    334406    } 
    335407 
     
    351423      factory<THandler>::bin_op_type impl = factory<THandler>::get_binary_operator(op); 
    352424      if (get_return_type(op, type_invalid) == type_bool) { 
    353         return impl->evaluate(handler, right, left); 
     425        return impl->evaluate(handler, left, right); 
    354426      } 
    355427      handler.error(_T("Missing operator implementation")); 
     
    360432      factory<THandler>::un_op_type impl = factory<THandler>::get_unary_operator(op); 
    361433      value_type type = get_return_type(op, type_invalid); 
    362       if (type == type_bool || type == type_int) { 
     434      if (type_is_int(type)) { 
    363435        return impl->evaluate(handler, subject); 
    364436      } 
     
    366438      return expression_ast<THandler>(int_value(FALSE)); 
    367439    } 
     440    template<typename THandler> 
     441    bool unary_fun<THandler>::is_bound() const { 
     442      if (!e_fn.empty()) 
     443        return true; 
     444      if (i_fn) 
     445        return true; 
     446      return false; 
     447    } 
     448 
    368449    template<typename THandler> 
    369450    expression_ast<THandler> unary_fun<THandler>::evaluate(value_type type, THandler &handler) const { 
     
    372453      if (i_fn) 
    373454        return i_fn->evaluate(type, handler, subject); 
    374       handler.error(_T("Missing function binding: ") + name); 
     455      handler.error(_T("Missing function binding: ") + name + _T("bound: ") + strEx::itos(is_bound())); 
    375456      return expression_ast<THandler>(int_value(FALSE)); 
    376457    } 
     
    398479      } 
    399480    } 
     481    template<typename THandler> 
     482    bool unary_fun<THandler>::is_transparent(value_type type) { 
     483      // TODO make the handler be allowed to have a say here 
     484      if (name == _T("neg")) 
     485        return true; 
     486      return false; 
     487    } 
     488 
    400489 
    401490  } 
  • branches/stable/include/parsers/ast.hpp

    r262 r263  
    1313#include <boost/function.hpp> 
    1414 
     15#include <parsers/helpers.hpp> 
     16 
    1517#include <strEx.h> 
    1618 
     
    3638    struct nil {}; 
    3739 
    38  
    39  
    4040    enum operators { 
    41       op_eq, op_le, op_lt, op_gt, op_ge, op_ne, op_in, op_nin, op_or, op_and, op_inv, op_not 
     41      op_eq, op_le, op_lt, op_gt, op_ge, op_ne, op_in, op_nin, op_or, op_and, op_inv, op_not, op_like 
    4242    }; 
    4343 
     
    7575 
    7676    inline bool type_is_int(value_type type) { 
    77       return type == type_int || type == type_bool || (type >= type_custom_int && type < type_custom_int_end); 
     77      return type == type_int || type == type_bool || type == type_date || (type >= type_custom_int && type < type_custom_int_end); 
    7878    } 
    7979 
     
    104104      return _T("unknown:") + strEx::itos(type); 
    105105    } 
     106    inline std::wstring type_to_string(value_type type) { 
     107      return to_string(type); 
     108    } 
    106109 
    107110    inline std::wstring operator_to_string(operators const& identifier) { 
     
    112115      if (identifier == op_eq) 
    113116        return _T("="); 
     117      if (identifier == op_gt) 
     118        return _T(">"); 
     119      if (identifier == op_lt) 
     120        return _T("<"); 
     121      if (identifier == op_ge) 
     122        return _T(">="); 
     123      if (identifier == op_le) 
     124        return _T("<="); 
    114125      return _T("?"); 
    115126    } 
     
    245256      std::wstring name; 
    246257      expression_ast<THandler> subject; 
     258      bool is_transparent(value_type type); 
     259      bool is_bound() const; 
    247260    }; 
    248261 
  • branches/stable/include/parsers/eval.hpp

    r262 r263  
    1616          if (type == type_string) 
    1717            return eval_string(type, handler, left, right)?expression_ast<THandler>(int_value(TRUE)):expression_ast<THandler>(int_value(FALSE)); 
    18           handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     18          handler.error(_T("missing impl for simple bool binary operator")); 
    1919          return expression_ast<THandler>(int_value(FALSE)); 
    2020        } 
     
    2929        } 
    3030        bool eval_string(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 
    31           handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     31          handler.error(_T("missing impl for and binary operator")); 
    3232          // TODO convert strings 
    3333          return false; 
     
    4040        } 
    4141        bool eval_string(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 
    42           handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     42          handler.error(_T("missing impl for or binary operator")); 
    4343          // TODO convert strings 
    4444          return false; 
     
    100100      }; 
    101101      template<typename THandler> 
     102      struct operator_like : public simple_bool_binary_operator_impl<THandler> { 
     103        bool eval_int(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 
     104          return false; 
     105        } 
     106        bool eval_string(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const {  
     107          std::wstring s1 = left.get_string(handler); 
     108          std::wstring s2 = right.get_string(handler); 
     109          bool res; 
     110          if (s1.size() > s2.size() && s2.size() > 0) 
     111            return s1.find(s2) != std::wstring::npos; 
     112          return s2.find(s1) != std::wstring::npos; 
     113          //if (res) 
     114          //  std::wcout << _T("Found: ") << s1 << _T(" in ") << s2 << std::endl; 
     115          return res; 
     116        }; 
     117      }; 
     118      template<typename THandler> 
    102119      struct operator_false : public binary_operator_impl<THandler>, unary_operator_impl<THandler>, binary_function_impl<THandler> { 
    103120        expression_ast<THandler> evaluate(THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 
    104           handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     121          handler.error(_T("missing impl for FALSE")); 
    105122          return expression_ast<THandler>(int_value(FALSE)); 
    106123        } 
    107124        expression_ast<THandler> evaluate(THandler &handler, const expression_ast<THandler> &subject) const { 
    108           handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     125          handler.error(_T("missing impl for FALSE")); 
    109126          return expression_ast<THandler>(int_value(FALSE)); 
    110127        } 
    111128        expression_ast<THandler> evaluate(parsers::where::value_type type,THandler &handler, const expression_ast<THandler> &subject) const { 
    112           handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     129          handler.error(_T("missing impl for FALSE")); 
    113130          return expression_ast<THandler>(int_value(FALSE)); 
    114131        } 
     
    117134      template<typename THandler> 
    118135      struct function_convert : public binary_function_impl<THandler> { 
     136        typename expression_ast<THandler> list_entry; 
     137        typedef typename expression_ast<THandler>::list_type list_type; 
    119138        typename expression_ast<THandler>::list_type list; 
    120139        bool single_item; 
     
    128147              return expression_ast<THandler>(string_value(list.front().get_string(handler))); 
    129148            } 
    130             handler.error(_T("Failed to handle type: ") + to_string(type)); 
     149            handler.error(_T("1:Failed to handle type: ") + to_string(type)); 
    131150            return expression_ast<THandler>(int_value(FALSE)); 
    132           } else { 
    133             std::wcout << _T("----------------------------------------------\n"); 
    134             std::wcout << list.size() << _T("\n"); 
    135             std::wcout << subject.to_string() << _T("\n"); 
    136             std::wcout << _T("----------------------------------------------\n"); 
    137             handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     151          } 
     152          if (list.size()==2) { 
     153            list_type::const_iterator item = list.begin(); 
     154            list_type::const_iterator unit = item; 
     155            std::advance(unit, 1); 
     156            if (type == type_date) { 
     157              return expression_ast<THandler>(int_value(parse_time((*item).get_int(handler), (*unit).get_string(handler)))); 
     158            } 
     159            handler.error(_T("m:Failed to handle type: ") + to_string(type) + _T(" ") + (*item).to_string() + _T(", ") + (*unit).to_string()); 
    138160            return expression_ast<THandler>(int_value(FALSE)); 
    139161          } 
    140         } 
     162          std::wcout << _T("----------------------------------------------\n"); 
     163          std::wcout << list.size() << _T("\n"); 
     164          std::wcout << subject.to_string() << _T("\n"); 
     165          std::wcout << _T("----------------------------------------------\n"); 
     166          handler.error(_T("Missing implementation for convert function")); 
     167          return expression_ast<THandler>(int_value(FALSE)); 
     168        } 
     169 
     170        inline long long parse_time(unsigned int value, std::wstring unit) const { 
     171          long long now = constants::get_now(); 
     172          if (unit.empty()) 
     173            return now + value; 
     174          else if ( (unit == _T("s")) || (unit == _T("S")) ) 
     175            return now + (value); 
     176          else if ( (unit == _T("m")) || (unit == _T("M")) ) 
     177            return now + (value * 60); 
     178          else if ( (unit == _T("h")) || (unit == _T("H")) ) 
     179            return now + (value * 60 * 60); 
     180          else if ( (unit == _T("d")) || (unit == _T("D")) ) 
     181            return now + (value * 24 * 60 * 60); 
     182          else if ( (unit == _T("w")) || (unit == _T("W")) ) 
     183            return now + (value * 7 * 24 * 60 * 60); 
     184          return now + value; 
     185        } 
     186 
    141187      }; 
    142188 
     
    150196          if (type == type_string) 
    151197            return eval_string(type, handler, subject)?expression_ast<THandler>(int_value(TRUE)):expression_ast<THandler>(int_value(FALSE)); 
    152           handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     198          handler.error(_T("missing impl for bool unary operator")); 
    153199          return expression_ast<THandler>(int_value(FALSE)); 
    154200        } 
     
    158204 
    159205      template<typename THandler> 
    160       struct operator_not : public unary_operator_impl<THandler> { 
     206      struct operator_not : public unary_operator_impl<THandler>, binary_function_impl<THandler> { 
     207        operator_not(const expression_ast<THandler> &subject) {} 
     208        operator_not() {} 
    161209        expression_ast<THandler> evaluate(THandler &handler, const expression_ast<THandler> &subject) const { 
    162           value_type type = subject.get_type(); 
     210          return evaluate(subject.get_type(), handler, subject); 
     211        } 
     212        expression_ast<THandler> evaluate(value_type type, THandler &handler, const expression_ast<THandler> &subject) const { 
    163213          if (type == type_bool) 
    164214            return subject.get_int(handler)?expression_ast<THandler>(int_value(TRUE)):expression_ast<THandler>(int_value(FALSE)); 
    165215          if (type == type_int) 
    166216            return  expression_ast<THandler>(int_value(-subject.get_int(handler))); 
    167           handler.error(_T("*** MISSING OPERATION IMPL ***")); 
     217          if (type == type_date) { 
     218            long long now = constants::get_now(); 
     219            long long val = now - (subject.get_int(handler) - now); 
     220            return expression_ast<THandler>(int_value(val)); 
     221          } 
     222          handler.error(_T("missing impl for NOT operator")); 
    168223          return expression_ast<THandler>(int_value(FALSE)); 
    169224        } 
     
    185240      if (op == op_ne) 
    186241        return bin_op_type(new operator_impl::operator_ne<THandler>()); 
     242      if (op == op_like) 
     243        return bin_op_type(new operator_impl::operator_like<THandler>()); 
    187244 
    188245      if (op == op_and) 
     
    200257      if (name == _T("auto_convert")) 
    201258        return bin_fun_type(new operator_impl::function_convert<THandler>(subject)); 
     259      if (name == _T("neg")) 
     260        return bin_fun_type(new operator_impl::operator_not<THandler>(subject)); 
    202261      std::wcout << _T("======== UNDEFINED FUNCTION: ") << name << std::endl; 
    203262      return bin_fun_type(new operator_impl::operator_false<THandler>()); 
  • branches/stable/include/parsers/grammar.cpp

    r262 r263  
    6666      expression_ast<THandler> operator()(wchar_t const unit, expression_ast<THandler> const & vars) const { 
    6767        list_value<THandler> args = list_value<THandler>(vars); 
    68         args += string_value(std::wstring(0, unit)); 
     68        args += string_value(std::wstring(1, unit)); 
    6969        return expression_ast<THandler>(unary_fun<THandler>(_T("convert"), args)); 
    7070      } 
     
    154154          | qi::lit("ge")                   [_val = op_ge] 
    155155          | qi::lit("gt")                   [_val = op_gt] 
     156          | qi::lit("like")                 [_val = op_like] 
    156157          ; 
    157158 
  • branches/stable/include/parsers/where.cpp

    r262 r263  
    4747        if (src == type_invalid || dst == type_invalid) 
    4848          return false; 
     49        if (dst == type_tbd) 
     50          return false; 
    4951        if (src == type_tbd) 
    50           return false; 
    51         if (dst == type_tbd) 
    5252          return true; 
    5353        if (src == type_int && dst == type_string) 
     
    7171          return type_tbd; 
    7272        if (handler.can_convert(rt, lt)) { 
     73          std::wcout << _T("FORCE 001") << std::endl; 
    7374          right.force_type(lt); 
    7475          return lt; 
    7576        } 
    7677        if (handler.can_convert(lt, rt)) { 
     78          std::wcout << _T("FORCE 002") << std::endl; 
    7779          left.force_type(rt); 
    7880          return rt; 
    7981        } 
    8082        if (can_convert(rt, lt)) { 
     83          std::wcout << _T("FORCE 003") << std::endl; 
    8184          right.force_type(lt); 
    8285          return rt; 
    8386        } 
    8487        if (can_convert(lt, rt)) { 
     88          std::wcout << _T("FORCE 004") << std::endl; 
    8589          left.force_type(rt); 
    8690          return lt; 
     
    160164 
    161165      bool operator()(unary_fun<THandler> & expr) { 
    162         if ((expr.name == _T("convert")) || (expr.name == _T("auto_convert")) ) { 
     166        if ((expr.name == _T("convert")) || (expr.name == _T("auto_convert") || expr.is_transparent(type_tbd) ) ) { 
    163167          return boost::apply_visitor(*this, expr.subject.expr); 
    164168        } 
     
    209213 
    210214      bool operator()(unary_fun<THandler> & expr) { 
    211         return false; 
     215        operator()(expr.subject); 
     216        return true; 
    212217      } 
    213218 
    214219      bool operator()(list_value<THandler> & expr) { 
    215         // TODO: this is incorrect! 
     220        BOOST_FOREACH(expression_ast<THandler> e, expr.list) { 
     221          operator()(e); 
     222        } 
    216223        return true; 
    217224      } 
     
    234241    template<typename THandler> 
    235242    bool parser<THandler>::parse(std::wstring expr) { 
     243      constants::reset(); 
     244      std::wcout << _T("Current time is: ") << constants::get_now() << std::endl; 
    236245      typedef std::wstring::const_iterator iterator_type; 
    237246      typedef where_grammar<THandler, iterator_type> grammar; 
  • branches/stable/modules/CheckEventLog/CheckEventLog-2005.vcproj

    r262 r263  
    15721572        <FileConfiguration 
    15731573          Name="Debug|x64" 
     1574          > 
     1575          <Tool 
     1576            Name="VCCLCompilerTool" 
     1577            UsePrecompiledHeader="0" 
     1578          /> 
     1579        </FileConfiguration> 
     1580      </File> 
     1581      <File 
     1582        RelativePath="..\..\include\parsers\helpers.cpp" 
     1583        > 
     1584        <FileConfiguration 
     1585          Name="Release|Win32" 
     1586          > 
     1587          <Tool 
     1588            Name="VCCLCompilerTool" 
     1589            UsePrecompiledHeader="0" 
     1590          /> 
     1591        </FileConfiguration> 
     1592        <FileConfiguration 
     1593          Name="Release|x64" 
     1594          > 
     1595          <Tool 
     1596            Name="VCCLCompilerTool" 
     1597            UsePrecompiledHeader="0" 
     1598          /> 
     1599        </FileConfiguration> 
     1600        <FileConfiguration 
     1601          Name="Debug|Win32" 
     1602          > 
     1603          <Tool 
     1604            Name="VCCLCompilerTool" 
     1605            UsePrecompiledHeader="0" 
     1606          /> 
     1607        </FileConfiguration> 
     1608        <FileConfiguration 
     1609          Name="Debug|x64" 
     1610          > 
     1611          <Tool 
     1612            Name="VCCLCompilerTool" 
     1613            UsePrecompiledHeader="0" 
     1614          /> 
     1615        </FileConfiguration> 
     1616        <FileConfiguration 
     1617          Name="Distribution|Win32" 
     1618          > 
     1619          <Tool 
     1620            Name="VCCLCompilerTool" 
     1621            UsePrecompiledHeader="0" 
     1622          /> 
     1623        </FileConfiguration> 
     1624        <FileConfiguration 
     1625          Name="Distribution|x64" 
     1626          > 
     1627          <Tool 
     1628            Name="VCCLCompilerTool" 
     1629            UsePrecompiledHeader="0" 
     1630          /> 
     1631        </FileConfiguration> 
     1632        <FileConfiguration 
     1633          Name="Nightly|Win32" 
     1634          > 
     1635          <Tool 
     1636            Name="VCCLCompilerTool" 
     1637            UsePrecompiledHeader="0" 
     1638          /> 
     1639        </FileConfiguration> 
     1640        <FileConfiguration 
     1641          Name="Nightly|x64" 
     1642          > 
     1643          <Tool 
     1644            Name="VCCLCompilerTool" 
     1645            UsePrecompiledHeader="0" 
     1646          /> 
     1647        </FileConfiguration> 
     1648        <FileConfiguration 
     1649          Name="Debug-MemCheck|Win32" 
     1650          > 
     1651          <Tool 
     1652            Name="VCCLCompilerTool" 
     1653            UsePrecompiledHeader="0" 
     1654          /> 
     1655        </FileConfiguration> 
     1656        <FileConfiguration 
     1657          Name="Debug-MemCheck|x64" 
     1658          > 
     1659          <Tool 
     1660            Name="VCCLCompilerTool" 
     1661            UsePrecompiledHeader="0" 
     1662          /> 
     1663        </FileConfiguration> 
     1664        <FileConfiguration 
     1665          Name="OP5|Win32" 
     1666          > 
     1667          <Tool 
     1668            Name="VCCLCompilerTool" 
     1669            UsePrecompiledHeader="0" 
     1670          /> 
     1671        </FileConfiguration> 
     1672        <FileConfiguration 
     1673          Name="OP5|x64" 
    15741674          > 
    15751675          <Tool 
     
    20882188      </File> 
    20892189      <File 
     2190        RelativePath="..\..\include\parsers\helpers.hpp" 
     2191        > 
     2192      </File> 
     2193      <File 
    20902194        RelativePath="..\..\include\NSCHelper.h" 
    20912195        > 
  • branches/stable/modules/CheckEventLog/CheckEventLog.cpp

    r262 r263  
    3636 
    3737#include <parsers/where.hpp> 
     38#include <simple_timer.hpp> 
    3839 
    3940#include "simple_registry.hpp" 
     
    4445 
    4546 
    46 class simple_timer { 
    47   unsigned long long start_time; 
    48 public: 
    49   simple_timer() { 
    50     start(); 
    51   } 
    52  
    53   void start() { 
    54     start_time = getFT(); 
    55   } 
    56   unsigned long long stop() { 
    57     unsigned int  ret = getFT() - start_time; 
    58     start(); 
    59     return ret/1000; 
    60   } 
    61  
    62 private: 
    63   unsigned long long getFT() { 
    64     SYSTEMTIME systemTime; 
    65     GetSystemTime( &systemTime ); 
    66     FILETIME fileTime; 
    67     SystemTimeToFileTime( &systemTime, &fileTime ); 
    68     return  static_cast<unsigned long long>(fileTime.dwHighDateTime) << 32 | fileTime.dwLowDateTime; 
    69   } 
    70  
    71 }; 
     47 
    7248 
    7349BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved) 
     
    154130      } 
    155131      long long get_written() { 
    156         if (record == NULL) throw _T("Whoops"); return record->timeWritten();  
     132        if (record == NULL) throw _T("Whoops"); return record->written();  
    157133      } 
    158134      long long get_generated() { 
    159         if (record == NULL) throw _T("Whoops"); return record->timeGenerated();  
     135        if (record == NULL) throw _T("Whoops"); return record->generated();  
    160136      } 
    161137 
     
    334310        if (data.bDebug && (i>data.debugThreshold)) 
    335311          NSC_DEBUG_MSG_STD(_T("[") + strEx::itos(i) + _T("] Matched: + ") + (*cit3).second.to_string() + _T(" for: ") + record.render(data.bShowDescriptions, data.syntax)); 
    336         return true; 
     312        return false; 
    337313      } else if (bTmpMatched) { 
    338314        if (data.bDebug && (i>data.debugThreshold)) 
     
    376352      NSC_DEBUG_MSG_STD(_T("Type resolution succeeded: ") + ast_parser.result_as_tree()); 
    377353 
     354    if (!ast_parser.bind(dummy) || dummy.has_error()) { 
     355      message = _T("Variable and function binding failed: ") + dummy.get_error(); 
     356      return false; 
     357    } 
     358    if (data.bDebug) 
     359      NSC_DEBUG_MSG_STD(_T("Binding succeeded: ") + ast_parser.result_as_tree()); 
     360 
    378361    if (!ast_parser.static_eval(dummy) || dummy.has_error()) { 
    379362      message = _T("Static evaluation failed: ") + dummy.get_error(); 
     
    383366      NSC_DEBUG_MSG_STD(_T("Static evaluation succeeded: ") + ast_parser.result_as_tree()); 
    384367 
    385     if (!ast_parser.bind(dummy) || dummy.has_error()) { 
    386       message = _T("Variable and function binding failed: ") + dummy.get_error(); 
    387       return false; 
    388     } 
    389     if (data.bDebug) 
    390       NSC_DEBUG_MSG_STD(_T("Binding succeeded: ") + ast_parser.result_as_tree()); 
    391368    return true; 
    392369  } 
     
    397374    if (obj.has_error()) { 
    398375      NSC_LOG_ERROR_STD(_T("Error: ") + obj.get_error()); 
    399  
    400376    } 
    401377    return ret; 
     
    703679  filter_impl->boot(); 
    704680 
     681  __time64_t ltime; 
     682  _time64(&ltime); 
     683 
    705684  NSC_DEBUG_MSG_STD(_T("Using: ") + filter_impl->get_name()); 
    706685 
     
    708687    return NSCAPI::returnUNKNOWN; 
    709688  } 
     689 
    710690 
    711691  NSC_DEBUG_MSG_STD(_T("Boot time: ") + strEx::itos(time.stop())); 
     
    729709    DWORD dwRead, dwNeeded; 
    730710 
    731     __time64_t ltime; 
    732     _time64(&ltime); 
    733711 
    734712    //GetOldestEventLogRecord(hLog, &dwThisRecord); 
  • branches/stable/modules/CheckEventLog/Jamfile

    r262 r263  
    1313  ../../include/parsers/grammar.cpp 
    1414  ../../include/parsers/where.cpp 
     15  ../../include/parsers/helpers.cpp 
    1516 
    1617  : # requirements 
  • branches/stable/modules/CheckEventLog/eventlog_record.hpp

    r262 r263  
    1313  inline __int64 timeWritten() const { 
    1414    return (currentTime_-pevlr_->TimeWritten)*1000; 
     15  } 
     16  inline __int64 generated() const { 
     17    return pevlr_->TimeGenerated; 
     18  } 
     19  inline __int64 written() const { 
     20    return pevlr_->TimeWritten; 
    1521  } 
    1622  inline std::wstring eventSource() const { 
     
    205211    strEx::replace(syntax, _T("%generated%"), strEx::format_date(get_time_generated(), date_format)); 
    206212    strEx::replace(syntax, _T("%written%"), strEx::format_date(get_time_written(), date_format)); 
     213    strEx::replace(syntax, _T("%generated-raw%"), strEx::itos(pevlr_->TimeGenerated)); 
     214    strEx::replace(syntax, _T("%written-raw%"), strEx::itos(pevlr_->TimeWritten)); 
    207215    strEx::replace(syntax, _T("%type%"), translateType(eventType())); 
    208216    strEx::replace(syntax, _T("%severity%"), translateSeverity(severity())); 
Note: See TracChangeset for help on using the changeset viewer.