better diagnosics package collection

This commit is contained in:
Oliver Kieselbach
2026-04-05 17:19:22 +02:00
parent 29f1d7ab7b
commit e6390db5be
4 changed files with 21 additions and 6 deletions
+2 -1
View File
@@ -159,7 +159,8 @@
"C:\\Windows\\CCM\\Logs",
"C:\\ProgramData\\Microsoft\\DiagnosticLogCSP",
"C:\\ProgramData\\Microsoft\\Windows\\WER",
"C:\\Windows\\Logs\\CBS"
"C:\\Windows\\Logs\\CBS",
"C:\\Install\\Log"
],
"blockedFilePrefixes": [
"C:\\Users"
@@ -58,6 +58,9 @@ namespace AutopilotMonitor.Agent.Core.Monitoring.Collectors
// Windows Component-Based Servicing
@"C:\Windows\Logs\CBS",
// Custom install logs (e.g. app installers writing to C:\Install\Log\)
@"C:\Install\Log",
};
// Hard blocks: never allowed, even in unrestricted mode
@@ -50,6 +50,16 @@ namespace AutopilotMonitor.Agent.Core.Monitoring.Core
private static readonly string AgentLogFolder =
Environment.ExpandEnvironmentVariables(Constants.LogDirectory);
/// <summary>
/// File extensions collected from built-in log folders (Agent + IME).
/// Covers standard logs, structured data, traces, event logs, and diagnostics archives.
/// </summary>
private static readonly string[] LogFilePatterns = new[]
{
"*.log", "*.txt", "*.json", "*.jsonl",
"*.etl", "*.evtx", "*.xml", "*.csv", "*.cab"
};
public DiagnosticsPackageService(AgentConfiguration configuration, AgentLogger logger, BackendApiClient apiClient)
{
_configuration = configuration;
@@ -113,11 +123,12 @@ namespace AutopilotMonitor.Agent.Core.Monitoring.Core
AddSessionInfo(archive, enrollmentSucceeded);
// 2. Agent logs
AddLogFiles(archive, AgentLogFolder, "AgentLogs", "*.log");
foreach (var pattern in LogFilePatterns)
AddLogFiles(archive, AgentLogFolder, "AgentLogs", pattern);
// 3. IME logs
AddLogFiles(archive, ImeLogFolder, "ImeLogs", "IntuneManagementExtension*.log");
AddLogFiles(archive, ImeLogFolder, "ImeLogs", "AppWorkload*.log");
// 3. IME logs (all relevant files in the IME log folder)
foreach (var pattern in LogFilePatterns)
AddLogFiles(archive, ImeLogFolder, "ImeLogs", pattern);
// 4. Configured additional log paths (global + tenant, validated by guards)
foreach (var entry in _configuration.DiagnosticsLogPaths ?? new System.Collections.Generic.List<Shared.Models.DiagnosticsLogPath>())
@@ -1 +1 @@
842
846