Changeset edf0848 in nscp for modules


Ignore:
Timestamp:
04/13/10 23:47:25 (3 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
d1029bd
Parents:
5b10435
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:
modules/CheckEventLog
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • modules/CheckEventLog/CheckEventLog-2005.vcproj

    r5b10435 redf0848  
    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        > 
  • modules/CheckEventLog/CheckEventLog.cpp

    r5b10435 redf0848  
    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); 
  • modules/CheckEventLog/Jamfile

    r5b10435 redf0848  
    1313  ../../include/parsers/grammar.cpp 
    1414  ../../include/parsers/where.cpp 
     15  ../../include/parsers/helpers.cpp 
    1516 
    1617  : # requirements 
  • modules/CheckEventLog/eventlog_record.hpp

    r5b10435 redf0848  
    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.