--- title: DiagnosticLog CSP description: DiagnosticLog CSP ms.assetid: F76E0056-3ACD-48B2-BEA1-1048C96571C3 ms.reviewer: manager: dansimp ms.author: dansimp ms.topic: article ms.prod: w10 ms.technology: windows author: manikadhiman ms.date: 08/05/2019 --- # DiagnosticLog CSP The DiagnosticLog configuration service provider (CSP) is used in the following scenarios: - [Controlling ETW trace sessions](#diagnosticlog-csp-for-controlling-etw-trace-sessions) - [Triggering devices to upload existing event logs, log files, and registry values to cloud storage](#diagnosticlog-csp-for-triggering-devices-to-upload-files-to-cloud) ## DiagnosticLog CSP for controlling ETW trace sessions The DiagnosticLog CSP is used for generating and collecting diagnostic information from the device: Event Tracing for Windows (ETW) log files and current MDM configured state of the device. DiagnosticLog CSP supports the following type of event tracing: - Collector-based tracing - Channel-based tracing ### Collector-based tracing This type of event tracing simultaneously collects event data from a collection of registered ETW providers. An event collector is a container of registered ETW providers. Users can add or delete a collector node and register or unregister multiple providers in this collector. The ***CollectorName*** must be unique within the CSP and must not be a valid event channel name or a provider GUID. The DiagnosticLog CSP maintains a log file for each collector node and the log file is overwritten if a start command is triggered again on the same collector node. For each collector node, the user can: - Start or stop the session with all registered and enabled providers - Query session status - Change trace log file mode - Change trace log file size limit The configurations log file mode and log file size limit does not take effect while trace session is in progress. These are applied when user stops the current session and then starts it again for this collector. For each registered provider in this collector, the user can: - Specify keywords to filter events from this provider - Change trace level to filter events from this provider - Enable or disable the provider in the trace session The changes on **State**, **Keywords** and **TraceLevel** takes effect immediately while trace session is in progress. > [!Note] > Microsoft-WindowsPhone-Enterprise-Diagnostics-Provider (GUID - 3da494e4-0fe2-415C-b895-fb5265c5c83b) has the required debug resource files built into Windows OS, which will allow the logs files to be decoded on the remote machine. Any other logs may not have the debug resources required to decode. ### Channel-based tracing The type of event tracing exports event data from a specific channel. This is only supported on the desktop. Users can add or delete a channel node using the full name, such as Microsoft-Windows-AppModel-Runtime/Admin. The DiagnosticLog CSP maintains a log file for each channel node and the log file is overwritten if a start command is triggered again on the same channel node. For each channel node, the user can: - Export channel event data into a log file (.evtx) - Enable or disable the channel from Event Log service to allow or disallow event data being written into the channel - Specify an XPath query to filter events while exporting the channel event data For more information about using DiagnosticLog to collect logs remotely from a PC or mobile device, see [Diagnose MDM failures in Windows 10](diagnose-mdm-failures-in-windows-10.md). Here are the links to the DDFs: - [DiagnosticLog CSP version 1.2](diagnosticlog-ddf.md#version-1-2) - [DiagnosticLog CSP version 1.3](diagnosticlog-ddf.md#version-1-3) The following diagram shows the DiagnosticLog CSP in tree format. ![diagnosticlog csp diagram](images/provisioning-csp-diagnosticlog.png) **./Vendor/MSFT/DiagnosticLog** The root node for the DiagnosticLog CSP. To gather diagnostics using this CSP: 1. Specify a *CollectorName* for the container of the target ETW providers. 2. (Optional) Set logging and log file parameters using the following options: - TraceLogFileMode - LogFileSizeLimitMB 3. Indicate one or more target ETW providers by supplying its *ProviderGUID* to the Add operation of EtwLog/Collectors/*CollectorName*/Providers/*ProviderGUID*. 4. (Optional) Set logging and log file parameters using the following options: - TraceLevel - Keywords 5. Start logging using **TraceControl** EXECUTE command “START”. 6. Perform actions on the target device that will generate activity in the log files. 7. Stop logging using **TraceControl** EXECUTE command “STOP”. 8. Collect the log file located in the `%temp%` folder using the method described in [Reading a log file](#reading-a-log-file). **EtwLog** Node to contain the Error Tracing for Windows log. The supported operation is Get. **EtwLog/Collectors** Interior node to contain dynamic child interior nodes for active providers. The supported operation is Get. **EtwLog/Collectors/***CollectorName* Dynamic nodes to represent active collector configuration. Supported operations are Add, Delete, and Get. Add a collector ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement node ``` Delete a collector ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement ``` **EtwLog/Collectors/*CollectorName*/TraceStatus** Specifies whether the current logging status is running. The data type is an integer. The supported operation is Get. The following table represents the possible values: | Value | Description | |-------|-------------| | 0 | Stopped | | 1 | Started | **EtwLog/Collectors/*CollectorName*/TraceLogFileMode** Specifies the log file logging mode. The data type is an integer. Supported operations are Get and Replace. The following table lists the possible values: | Value | Description | |-------|--------------------| | EVENT_TRACE_FILE_MODE_SEQUENTIAL (0x00000001) | Writes events to a log file sequentially; stops when the file reaches its maximum size. | | EVENT_TRACE_FILE_MODE_CIRCULAR (0x00000002) | Writes events to a log file. After the file reaches the maximum size, the oldest events are replaced with incoming events. | **EtwLog/Collectors/*CollectorName*/TraceControl** Specifies the logging and report action state. The data type is a string. The following table lists the possible values: | Value | Description | |-------|--------------------| | START | Start log tracing. | | STOP | Stop log tracing | The supported operation is Execute. After you have added a logging task, you can start a trace by running an Execute command on this node with the value START. To stop the trace, running an execute command on this node with the value STOP. Start collector trace logging ```xml 2 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement/TraceControl chr START ``` Stop collector trace logging ```xml 2 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement/TraceControl chr STOP ``` **EtwLog/Collectors/*CollectorName*/LogFileSizeLimitMB** Sets the log file size limit, in MB. The data type is an integer. Valid values are 1-2048. The default value is 4. Supported operations are Get and Replace. **EtwLog/Collectors/*CollectorName*/Providers** Interior node to contain dynamic child interior nodes for active providers. The supported operation is Get. **EtwLog/Collectors/*CollectorName*/Providers/***ProviderGUID* Dynamic nodes to represent active provider configuration per provider GUID. > **Note**  Microsoft-WindowsPhone-Enterprise-Diagnostics-Provider (GUID - 3da494e4-0fe2-415C-b895-fb5265c5c83b) has the required debug resource files built into Windows OS, which will allow the logs files to be decoded on the remote machine. Any other logs may not have the debug resources required to decode. Supported operations are Add, Delete, and Get. Add a provider ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement/Providers/3da494e4-0fe2-415C-b895-fb5265c5c83b node ``` Delete a provider ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement/Providers/3da494e4-0fe2-415C-b895-fb5265c5c83b ``` **EtwLog/Collectors/*CollectorName*/Providers/*ProviderGUID*/TraceLevel** Specifies the level of detail included in the trace log. The data type is an integer. Supported operations are Get and Replace. The following table lists the possible values: | Value | Description | |-------|--------------------| | 1 – TRACE_LEVEL_CRITICAL | Abnormal exit or termination events | | 2 – TRACE_LEVEL_ERROR | Severe error events | | 3 – TRACE_LEVEL_WARNING | Warning events such as allocation failures | | 4 – TRACE_LEVEL_INFORMATION | Non-error events, such as entry or exit events | | 5 – TRACE_LEVEL_VERBOSE | Detailed information | Set provider **TraceLevel** ```xml 2 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement/Providers/3da494e4-0fe2-415C-b895-fb5265c5c83b/TraceLevel int 1 ``` **EtwLog/Collectors/*CollectorName*/Providers/*ProviderGUID*/Keywords** Specifies the provider keywords to be used as MatchAnyKeyword for this provider. The data type is a string. Supported operations are Get and Replace. Default value is 0 meaning no keyword. Get provider **Keywords** ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement/Providers/3da494e4-0fe2-415C-b895-fb5265c5c83b/Keywords ``` Set provider **Keywords** ```xml 4 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement/Providers/3da494e4-0fe2-415C-b895-fb5265c5c83b/Keywords chr text/plain 12345678FFFFFFFF ``` **EtwLog/Collectors/*CollectorName*/Providers/*ProviderGUID*/State** Specifies if this provider is enabled in the trace session. The data type is a boolean. Supported operations are Get and Replace. This change will be effective during active trace session. The following table lists the possible values: | Value | Description | |-------|--------------------| | TRUE | Provider is enabled in the trace session. This is the default. | | FALSE | Provider is disabled in the trace session. | Set provider **State** ```xml 2 ./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors/DeviceManagement/Providers/3da494e4-0fe2-415C-b895-fb5265c5c83b/State bool false ``` **EtwLog/Channels** Interior node to contain dynamic child interior nodes for registered channels. The supported operation is Get. **EtwLog/Channels/***ChannelName* Dynamic nodes to represent a registered channel. The node name must be a valid Windows event log channel name, such as "Microsoft-Client-Licensing-Platform%2FAdmin" Supported operations are Add, Delete, and Get. Add a channel ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Channels/Microsoft-Client-Licensing-Platform%2FAdmin node ``` Delete a channel ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Channels/Microsoft-Client-Licensing-Platform%2FAdmin ``` **EtwLog/Channels/*ChannelName*/Export** Node to trigger the command to export channel event data into the log file. The supported operation is Execute. Export channel event data ```xml 2 ./Vendor/MSFT/DiagnosticLog/EtwLog/Channels/Microsoft-Client-Licensing-Platform%2FAdmin/Export ``` **EtwLog/Channels/*ChannelName*/Filter** Specifies the XPath query string to filter the events while exporting. The data type is a string. Supported operations are Get and Replace. Default value is empty string. Get channel **Filter** ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Channels/Microsoft-Client-Licensing-Platform%2FAdmin/Filter ``` **EtwLog/Channels/*ChannelName*/State** Specifies if the Channel is enabled or disabled. The data type is a boolean. Supported operations are Get and Replace. The following table lists the possible values: | Value | Description | |-------|--------------------| | TRUE | Channel is enabled. | | FALSE | Channel is disabled. | Get channel **State** ```xml 1 ./Vendor/MSFT/DiagnosticLog/EtwLog/Channels/Microsoft-Client-Licensing-Platform%2FAdmin/State ``` Set channel **State** ```xml 2 ./Vendor/MSFT/DiagnosticLog/EtwLog/Channels/Microsoft-Client-Licensing-Platform%2FAdmin/State bool false ``` **DeviceStateData** Added in version 1.3 of the CSP in Windows 10, version 1607. Node for all types of device state data that are exposed. **DeviceStateData/MdmConfiguration** Added in version 1.3 of the CSP in Windows 10, version 1607. Triggers the snapping of device management state data with SNAP. The supported value is Execute. ```xml 2 ./Vendor/MSFT/DiagnosticLog/DeviceStateData/MdmConfiguration chr SNAP ``` **FileDownload** Node to contain child nodes for log file transportation protocols and corresponding actions. **FileDownload/DMChannel** Node to contain child nodes using DM channel for transport protocol. **FileDownload/DMChannel/***FileContext* Dynamic interior nodes that represents per log file context. **FileDownload/DMChannel/*FileContext*/BlockSizeKB** Sets the log read buffer, in KB. The data type is an integer. Valid values are 1-16. The default value is 4. Supported operations are Get and Replace. Set **BlockSizeKB** ```xml 1 ./Vendor/MSFT/DiagnosticLog/FileDownload/DMChannel/DeviceManagement/BlockSizeKB int 1 ``` Get **BlockSizeKB** ```xml 1 ./Vendor/MSFT/DiagnosticLog/FileDownload/DMChannel/DeviceManagement/BlockSizeKB ``` **FileDownload/DMChannel/*FileContext*/BlockCount** Represents the total read block count for the log file. The data type is an integer. The only supported operation is Get. Get **BlockCount** ```xml 1 ./Vendor/MSFT/DiagnosticLog/FileDownload/DMChannel/DeviceManagement/BlockCount ``` **FileDownload/DMChannel/*FileContext*/BlockIndexToRead** Represents the read block start location. The data type is an integer. Supported operations are Get and Replace. Set **BlockIndexToRead** at 0 ```xml 1 ./Vendor/MSFT/DiagnosticLog/FileDownload/DMChannel/DeviceManagement/BlockIndexToRead int 0 ``` Set **BlockIndexToRead** at 1 ```xml 1 ./Vendor/MSFT/DiagnosticLog/FileDownload/DMChannel/DeviceManagement/BlockIndexToRead int 1 ``` **FileDownload/DMChannel/*FileContext*/BlockData** The data type is Base64. The only supported operation is Get. Get **BlockData** ```xml 1 ./Vendor/MSFT/DiagnosticLog/FileDownload/DMChannel/DeviceManagement/BlockData ``` **FileDownload/DMChannel/*FileContext*/DataBlocks** Node to transfer the selected log file block to the DM server. **FileDownload/DMChannel/*FileContext*/DataBlocks/***BlockNumber* The data type is Base64. The supported operation is Get. **Policy** Added in Windows 10, version 1903. Root node to control settings for channels in Event Log. The supported operation is Get. **Policy/Channels** Added in Windows 10, version 1903. Node that contains Event Log channel settings. The supported operation is Get. **Policy/Channels/_ChannelName_** Added in Windows 10, version 1903. Dynamic node to represent a registered channel. The node name must be a valid Windows event log channel name, such as ``Microsoft-Client-Licensing-Platform%2FAdmin``. When specifying the name in the LocURI, it must be URL encoded, otherwise it may unexpectedly translate into a different URI. Supported operations are Add, Delete, and Get. Add **Channel** ``` xml 2​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName​ node​ ​ ``` Delete **Channel** ``` xml 3​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName​ ``` Get **Channel** ``` xml 4​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName​ ``` **Policy/Channels/_ChannelName_/MaximumFileSize** Added in Windows 10, version 1903. This policy setting specifies the maximum size of the log file in megabytes. If you enable this policy setting, you can configure the maximum log file size to be between 1 megabyte and 2 terabytes in megabyte increments. If you disable or do not configure this policy setting, the maximum size of the log file will be set to the locally configured value. This value can be changed by the local administrator using the Log Properties dialog, and it defaults to 1 megabyte. Supported operations are Add, Delete, Get, and Replace. The data type is integer. Add **MaximumFileSize** ``` xml 6​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/MaximumFileSize​ inttext/plain​ ​ 3 ``` Delete **MaximumFileSize** ``` xml 7​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/MaximumFileSize​ ``` Get **MaximumFileSize** ``` xml 5​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/MaximumFileSize​ ``` Replace **MaximumFileSize** ``` xml 8​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/MaximumFileSize​ inttext/plain​ ​ 5 ``` **Policy/Channels/_ChannelName_/SDDL** Added in Windows 10, version 1903. This policy setting represents SDDL string controlling access to the channel. Supported operations are Add, Delete, Get, and Replace. The data type is string. Default string is as follows: https://docs.microsoft.com/en-us/windows/desktop/WES/eventmanifestschema-channeltype-complextype. Add **SDDL** ``` xml 10​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/SDDL​ chrtext/plain​ ​ YourSDDL ``` Delete **SDDL** ``` xml 11​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/SDDL​ ``` Get **SDDL** ``` xml 9​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/SDDL​ ``` Replace **SDDL** ``` xml 12​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/SDDL​ chrtext/plain​ ​ YourNewSDDL ``` **Policy/Channels/_ChannelName_/ActionWhenFull** Added in Windows 10, version 1903. This policy setting controls Event Log behavior when the log file reaches its maximum size. Supported operations are Add, Delete, Get, and Replace. The data type is string. The following are the possible values: - Truncate — When the log file reaches its maximum file size, new events are not written to the log and are lost. - Overwrite — When the log file reaches its maximum file size, new events overwrite old events. - Archive — When the log file reaches its maximum size, the log file is saved to the location specified by the "Archive Location" policy setting. If archive location value is not set, the new file is saved in the same directory as current log file. If you disable or do not configure this policy setting, the locally configured value will be used as default. Every channel that is installed, whether inbox or by ISVs, is responsible for defining its own local configuration, and that configuration can be changed by any administrator. Values set via this policy override but do not replace local configuration. Add **ActionWhenFull** ``` xml 14​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/ActionWhenFull​ chrtext/plain​ ​ Archive ``` Delete **ActionWhenFull** ``` xml 15​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/ActionWhenFull​ ``` Get **ActionWhenFull** ``` xml 13​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/ActionWhenFull​ ``` Replace **ActionWhenFull** ``` xml 16​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/ActionWhenFull​ chrtext/plain​ ​ Truncate ``` **Policy/Channels/_ChannelName_/Enabled** Added in Windows 10, version 1903. This policy setting specifies whether the channel should be enabled or disabled. Supported operations are Add, Delete, Get, and Replace. The data type is boolean. The following are the possible values: - TRUE — Enables the channel. - FALSE — Disables the channel. If you disable or do not configure this policy setting, the locally configured value is used as default. Get **Enabled** ``` xml 17​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/Enabled​ ``` Add **Enabled** ``` xml 18​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/Enabled​ booltext/plain​ ​ TRUE ``` Delete **Enabled** ``` xml 19​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/Enabled​ ``` Replace **Enabled** ``` xml 20​ ./Vendor/MSFT/DiagnosticLog/Policy/Channels/ChannelName/Enabled​ booltext/plain​ ​ FALSE ``` ## DiagnosticLog CSP for triggering devices to upload files to cloud The DiagnosticLog CSP is used for triggering devices to upload existing event logs, log files, and registry values to cloud storage. The following section describes the nodes for the DiagnosticsArchive functionality. **DiagnosticArchive** Added in Windows 10, version 1903. Root note for the DiagnosticsArchive functionality. The supported operation is Get. **DiagnosticArchive/ArchiveDefinition** Added in Windows 10, version 1903. The supported operations are Add and Execute. The data type is string. Expected value: Set and Execute are functionality equivalent, and each accepts an XML snippet (as a string) describing what data to gather and where to upload it when done. This XML defines what should be collected and compressed into a zip file to be uploaded to Azure blog storage. The following is an example of the XML. This example instructs that a zip file be created containing the output from a dump of the specified registry key, all the files in a folder, the output of two commands, all the files in another folder, the output of a command, all the Application events, two sets of files, and another command output. All of this will be uploaded to the blob storage URL as specified in the tags and must be in the noted format with the container and the key in the URL. The administrator can retrieve this URL from Azure. The file uploaded will be in the format DiagLogs-{ComputerName}-YYYYMMDDTHHMMSSZ.zip. ``` xml f1e20cb4-9789-4f6b-8f6a-766989764c6d {web address}/{container}{key} HKLM\Software\Policies C:\ProgramData\Microsoft\DiagnosticLogCSP\Collectors\*.etl %windir%\system32\ipconfig.exe /all %windir%\system32\mdmdiagnosticstool.exe -out c:\ProgramData\temp\ c:\ProgramData\temp\*.* %windir%\system32\ping.exe -n 50 localhost Application %ProgramData%\Microsoft\DiagnosticLogCSP\Collectors\*.etl %SystemRoot%\System32\LogFiles\wmi\*.etl.* %windir%\system32\pnputil.exe /enum-drivers ``` Where: - ID is a unique GUID value that defines this particular run of the DiagnosticLog CSP. - There can be multiple RegistryKey, FolderFiles, Command, and Events elements, which extract or execute and collect the output from the action specified. - SasUrl is generated from the Azure Blob Storage UX in Azure such that it will allow write access to the blob to upload the zip file created by all the actions specified. **DiagnosticArchive/ArchiveResults** Added in Windows 10, version 1903. This policy setting displays the results of the last archive run. The supported operation is Get. The data type is string. A Get to the above URI will return the results of the gathering of data for the last diagnostics request. So for the example above it returns: ``` xml 1 1 0 SyncHdr 200 2 1 1 Get 200 3 1 1 ./Vendor/MSFT/DiagnosticLog/DiagnosticArchive/ArchiveResults f1e20cb4-9789-4f6b-8f6a-766989764c6d HKLM\Software\Policies C:\ProgramData\Microsoft\DiagnosticLogCSP\Collectors\*.etl %windir%\system32\ipconfig.exe /all %windir%\system32\mdmdiagnosticstool.exe -out c:\ProgramData\temp\ c:\ProgramData\temp\*.* %windir%\system32\ping.exe -n 50 localhost Application %ProgramData%\Microsoft\DiagnosticLogCSP\Collectors\*.etl %SystemRoot%\System32\LogFiles\wmi\*.etl.* %windir%\system32\pnputil.exe /enum-drivers ``` > [!Note] > Each data gathering node is annotated with the HRESULT of the option and the collection is also annotated with an HRESULT. In this example, note that the mdmdiagnosticstool.exe command failed. ## Reading a log file To read a log file: 1. Enumerate log file under **./Vendor/MSFT/DiagnosticLog/FileDownload/DMChannel**. 2. Select a log file in the Enumeration result. 3. Set **BlockSizeKB** per DM server payload limitation. 4. Get **BlockCount** to determine total read request. 5. Set **BlockIndexToRead** to initialize read start point. 6. Get **BlockData** for upload log block. 7. Increase **BlockIndexToRead**. 8. Repeat step 5 to 7 until **BlockIndexToRead == (BlockIndexToRead – 1)**.