Skip to content

Commit 1af6920

Browse files
CharityKathureCharity Kathure
andauthored
Rename Process Monitor Configuration Fields for Consistency (#185)
* change tagging Signed-off-by: Charity Kathure <ckathure@microsoft.com> --------- Signed-off-by: Charity Kathure <ckathure@microsoft.com> Co-authored-by: Charity Kathure <ckathure@microsoft.com>
1 parent 808b133 commit 1af6920

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

LogMonitor/LogMonitorTests/ConfigFileParserTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ namespace LogMonitorTests
17321732
}";
17331733

17341734
std::wstring logFormat = L"custom";
1735-
std::wstring customLogFormat = L"{'TimeStamp':'%TimeStamp%', 'source':'%Source%', 'Logline':'%Logline%'}";
1735+
std::wstring customLogFormat = L"{'TimeStamp':'%TimeStamp%', 'source':'%Source%', 'Message':'%Message%'}";
17361736
{
17371737
std::wstring configFileStr = Utility::FormatString(
17381738
configFileStrFormat.c_str(),

LogMonitor/docs/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ Each log source tracked by log monitor <em>(ETW, Log File, Events, and Process M
412412
<strong>Process Monitor:</strong>
413413
- `Source`: The log source (Process Monitor)
414414
- `TimeStamp`: Time at which the process was executed
415-
- `Logline` or `logEntry` : The output of the process/command executed
415+
- `Message` : The output of the process/command executed
416416

417417
### Sample Custom Log Configuration
418418

@@ -431,18 +431,18 @@ Each log source tracked by log monitor <em>(ETW, Log File, Events, and Process M
431431
"level": "Information"
432432
}
433433
],
434-
"customLogFormat": "{'TimeStamp':'%TimeStamp%', 'source':'%Source%', 'Severity':'%Severity%', 'ProviderId':'%ProviderId%', 'ProviderName':'%ProviderName%', 'EventId':'%EventId%', 'EventData':'%EventData%'}"
434+
"customLogFormat": "{'TimeStamp':'%TimeStamp%', 'Source':'%Source%', 'Severity':'%Severity%', 'ProviderId':'%ProviderId%', 'ProviderName':'%ProviderName%', 'EventId':'%EventId%', 'EventData':'%EventData%'}"
435435
},
436436
{
437437
"type": "File",
438438
"directory": "c:\\inetpub\\logs",
439439
"filter": "*.log",
440440
"includeSubdirectories": true,
441-
"customLogFormat": "{'message':%Message%,'source':%Source%,'fileName':%FileName%}"
441+
"customLogFormat": "{'Message':%Message%,'Source':%Source%,'fileName':%FileName%}"
442442
},
443443
{
444444
"type": "Process",
445-
"customLogFormat": "{'TimeStamp':'%TimeStamp%', 'source':'%Source%', 'Logline':'%Logline%'}"
445+
"customLogFormat": "{'TimeStamp':'%TimeStamp%', 'Source':'%Source%', 'Message':'%Message%'}"
446446
}
447447
]
448448
}
@@ -468,11 +468,11 @@ For example:
468468
"level": "Information"
469469
}
470470
],
471-
"customLogFormat": "{'TimeStamp':'%TimeStamp%', 'source':'%Source%', 'Severity':'%Severity%', 'ProviderId':'%ProviderId%', 'ProviderName':'%ProviderName%', 'EventId':'%EventId%', 'EventData':'%EventData%'}|json"
471+
"customLogFormat": "{'TimeStamp':'%TimeStamp%', 'Source':'%Source%', 'Severity':'%Severity%', 'ProviderId':'%ProviderId%', 'ProviderName':'%ProviderName%', 'EventId':'%EventId%', 'EventData':'%EventData%'}|json"
472472
},
473473
{
474474
"type": "Process",
475-
"customLogFormat": "{'TimeStamp':'%TimeStamp%', 'source':'%Source%', 'Logline':'%Logline%'}|JSON"
475+
"customLogFormat": "{'TimeStamp':'%TimeStamp%', 'Source':'%Source%', 'Message':'%Message%'}|JSON"
476476
}
477477
]
478478
}

LogMonitor/src/LogMonitor/Parser/LoggerSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ class SourceETW : LogSource
445445
class SourceProcess : LogSource
446446
{
447447
public:
448-
std::wstring CustomLogFormat = L"[%TimeStamp%] [%Source%] [%LogEntry%]";
448+
std::wstring CustomLogFormat = L"[%TimeStamp%] [%Source%] [%Message%]";
449449

450450
static bool Unwrap(
451451
_In_ AttributesMap& Attributes,

LogMonitor/src/LogMonitor/ProcessMonitor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ size_t FormatCustomLog(char* chBuf) {
260260
logEntry.currentTime = Utility::SystemTimeToString(st).c_str();
261261

262262
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> fromBytesconverter;
263-
logEntry.logLine = fromBytesconverter.from_bytes(chBufCpy);
263+
logEntry.message = fromBytesconverter.from_bytes(chBufCpy);
264264

265265
std::wstring_convert<std::codecvt_utf8<wchar_t>> toBytesconverter;
266266
std::wstring formattedLog = Utility::FormatEventLineLog(processCustomLogFormat, &logEntry, logEntry.source);
@@ -432,8 +432,7 @@ std::wstring ProcessMonitor::ProcessFieldsMapping(_In_ std::wstring fileFields,
432432

433433
if (Utility::CompareWStrings(fileFields, L"TimeStamp")) oss << pLogEntry->currentTime;
434434
if (Utility::CompareWStrings(fileFields, L"Source")) oss << pLogEntry->source;
435-
if (Utility::CompareWStrings(fileFields, L"logLine")
436-
|| Utility::CompareWStrings(fileFields, L"logEntry")) oss << pLogEntry->logLine;
435+
if (Utility::CompareWStrings(fileFields, L"Message")) oss << pLogEntry->message;
437436

438437
return oss.str();
439438
}

LogMonitor/src/LogMonitor/ProcessMonitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
struct ProcessLogEntry {
99
std::wstring source;
1010
std::wstring currentTime;
11-
std::wstring logLine;
11+
std::wstring message;
1212
};
1313

1414
DWORD CreateAndMonitorProcess(std::wstring& Cmdline, std::wstring LogFormat, std::wstring ProcessCustomLogFormat);

0 commit comments

Comments
 (0)