Changeset ec3fbc5 in nscp
- Timestamp:
- 02/22/06 23:25:11 (7 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- f42280d
- Parents:
- 1b7ae3d
- Files:
-
- 4 edited
-
changelog (modified) (3 diffs)
-
include/strEx.h (modified) (2 diffs)
-
modules/CheckEventLog/CheckEventLog.cpp (modified) (4 diffs)
-
modules/CheckEventLog/CheckEventLog.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
changelog
r6817602 rec3fbc5 7 7 * Add module for relaying events 8 8 * Check multitasking problems on the sockets. 9 * Add filtering to WMI module 10 * Fix WMI module 11 * Check date/time on eventlogs 12 * Add support for rendering results (eventlog etc) [In progress] 9 13 10 14 2006-02-12 MickeM 11 + Added new Interface for M Odules (NSCommandLineExec that allows modules to execute things give from command line.12 Syntax is NSClient++ <module name> <command> [arguments] and if a m podule doesn't support this it is simply ignored.15 + Added new Interface for Modules (NSCommandLineExec that allows modules to execute things give from command line. 16 Syntax is NSClient++ <module name> <command> [arguments] and if a module doesn't support this it is simply ignored. 13 17 + Added new install/uninstall command to SystemTray module: 14 18 NSClient++.exe SystemTray install … … 16 20 That will install/uninstall the system tray module this sets the "Allow Service to Interact with Desktop" flag for the service. 17 21 * Removed the "Allow Service to Interact with Desktop" flag from the /install option so that it no longer defaults to on (see commands to set this above). 18 * Fixed so checkProcess isn't case sensetive. 22 * Fixed so checkProcess isn't case sensitive. 23 * Added (not finished) syntax option to event log checker to format the outputted data 19 24 20 25 2006-02-12 MickeM … … 33 38 This new command (in development) will allow various file checks such as age, size, date, etc on single or multiple files. 34 39 + Added FILEAGE support to NSClient 35 + Started to convert the web page to WIKI40 + Started to convert the web page to WIKI 36 41 37 42 2006-01-21 MickeM -
include/strEx.h
r6817602 rec3fbc5 7 7 #include <list> 8 8 #include <functional> 9 #include <time.h> 9 10 #ifdef _DEBUG 10 11 #include <iostream> … … 19 20 } 20 21 22 inline std::string format_date(time_t time, std::string format) { 23 char buf[51]; 24 size_t l = strftime(buf, 50, format.c_str(), gmtime(&time)); 25 if (l <= 0 || l >= 50) 26 return ""; 27 buf[l] = 0; 28 return buf; 29 } 21 30 22 31 inline void replace(std::string &string, std::string replace, std::string with) { -
modules/CheckEventLog/CheckEventLog.cpp
r6817602 rec3fbc5 147 147 return strEx::itos(dwType); 148 148 } 149 std::string render(std::string syntax) { 150 strEx::replace(syntax, "%source%", eventSource()); 151 strEx::replace(syntax, "%generated%", strEx::format_date(pevlr_->TimeGenerated, DATE_FORMAT)); 152 strEx::replace(syntax, "%written%", strEx::format_date(pevlr_->TimeWritten, DATE_FORMAT)); 153 strEx::replace(syntax, "%type%", translateType(eventType())); 154 strEx::replace(syntax, "%severity%", translateSeverity(severity())); 155 strEx::replace(syntax, "%strings%", enumStrings()); 156 strEx::replace(syntax, "%id%", strEx::itos(eventID())); 157 return syntax; 158 } 149 159 }; 150 160 … … 203 213 bool bShowDescriptions = false; 204 214 unsigned int truncate = 0; 215 std::string syntax; 205 216 206 217 try { … … 212 223 MAP_OPTIONS_BOOL_EX("filter", bFilterIn, "in", "out") 213 224 MAP_OPTIONS_BOOL_EX("filter", bFilterAll, "all", "any") 225 MAP_OPTIONS_STR("syntax", syntax) 214 226 MAP_FILTER("filter-eventType", eventType) 215 227 MAP_FILTER("filter-severity", eventSeverity) … … 273 285 274 286 if ((bFilterIn&&bMatch)||(!bFilterIn&&!bMatch)) { 275 strEx::append_list(message, record.eventSource()); 276 if (bShowDescriptions) { 287 if (!syntax.empty()) { 288 strEx::append_list(message, record.render(syntax)); 289 } else if (bShowDescriptions) { 290 strEx::append_list(message, record.eventSource()); 291 } else { 292 strEx::append_list(message, record.eventSource()); 277 293 message += "(" + EventLogRecord::translateType(record.eventType()) + ", " + strEx::itos(record.eventID()) + ", " + EventLogRecord::translateSeverity(record.severity()) + ")"; 278 294 message += "[" + record.enumStrings() + "]"; -
modules/CheckEventLog/CheckEventLog.h
r75d5e70 rec3fbc5 4 4 #include <checkHelpers.hpp> 5 5 #include <filter_framework.hpp> 6 7 8 #define DATE_FORMAT "%#c" 6 9 7 10 class CheckEventLog {
Note: See TracChangeset
for help on using the changeset viewer.








