How to schedule CDF Tracing

Last Updated on August 11, 2020

Scheduling a CDF tracing is required when issue occurs at a certain time, for example during reboot schedule or at some random time between certain periods, for example when a user clicks a particular option in a published application. In either situation or probably more, you may or may not be available to capture CDF traces using CDFMonitor, CDFControl or Citrix Scout. Thankfully, with the help of Windows Task Scheduler, it is possible to schedule CDF tracing using either CDFMonitor or CDFControl.

Citrix Scout doesn’t require Task Scheduler to schedule CDF tracing. I will explain procedure to schedule CDF Tracing through Citrix Scout and CDF Control in a separate article.

In this article, I am going to show the detailed process to schedule CDF Tracing using CDFMonitor and Windows Task Scheduler.

Download Tools

Download CDFControl and CDFMonitor separately or download them as part of Citrix Supportability Pack. CSP is a collection of 41 tools that helps diagnose and troubleshoot Citrix Virtual Apps and Desktops.

Download TMF Files

TMF stands for trace message format. A very good explanation of TMF files is available at systemmanager.ru.

TMF files are required to view CDF Traces. A CDF trace contains unformatted event data (like any .etl trace file), which requires format information to construct the trace data into useful messages for viewing. Without valid TMF files that represent the message format of the captured trace, CDFControl (amongst other applications) will not be able to display any trace messages, because it would not know how to format the message data. In the past, Citrix has offered public TMF files via manual FTP download. For convenience, CDFControl offers the ability to download public TMF files so they can be saved locally – or used dynamically while parsing

I prefer downloading TMF files locally rather than letting CDFControl download them while parsing the *.ETL file. If you wish, you can skip this part. TMF files downloaded during the parsing process are cached at C:\ProgramData\Citrix\CDFControl\TMFCache.

  1. Extract supportability pack and go to \Citrix Supportability Pack\Tools\CDF Control
  2. Run CDFControl as an Administrator
CDFControl as an Administrator
  1. Click on Tools > Download TMF Files
CDFControl Tools Download TMF Files
  1. Select XAXD and click on Download
How to schedule CDF Tracing
  1. Browse the folder where you want to save TMF files. I created a folder by the name TMFs at Citrix Supportability Pack\Tools\CDF Control. CDFControl will create a folder by the name of the product – XAXD or UPM inside the folder you choose. Click on Select Folder
CDFControl Select Folder
  1. CDFControl will connect to TMF server (http://ctxsym.citrix.com/tmfs/xaxd/) and start downloading TMF files.
CDFControl downloading TMF files
  1. Once the download is complete, click on OK
CDFControl TMF Files downloaded
  1. It downloaded 31,496 files of 457 MB
CDFControl TMF Files folder
CDFControl TMF Files
  1. In CDFControl, click on Tools > Options
CDFControl Options
  1. Inside TMF consumer settings (for viewing CDF/ETW traces) section, browse the XAXD folder where TMF files were downloaded and click on select folder. Multi-select is possible, which means if there is another TMF files location that you want to save then click on Browse one more time and select that folder. Both locations will be saved separated by semi-colon (;).
  1. Uncheck Use online trace message format server. Click on Save.
CDFControl TMF search path
  1. Once the trace file is generated, you can come back to CDFControl and start debugging. I will cover that part in a separate article.

Schedule CDF Tracing using CDFMonitor and Windows Task Scheduler

To schedule CDF Tracing using CDF Monitor, you need to modify CDF Monitor configuration file to suit the needs of running a trace. It also involves creating two scheduled tasks to start and stop the tracing. Let’s see both steps in detail.

Modify CDFMonitor Config File

  1. I downloaded CDFMonitor as a part of Citrix Supportability Pack. I have not used CDFMonitor on this machine before that is why when I execute below command, it does not process anything. It is important to uninstall Citrix CDFMonitor as a service so we can use CDFMonitor.exe.config file with factory default settings. Next, we will modify some XML tags inside CDFMonitor.exe.config

E:\Citrix\Citrix Supportability Pack\Tools\CDF Monitor>CDFMonitor.exe /uninstallservice

How to schedule CDF Tracing
  1. Open CDFMonitor.exe.config from the CDFMonitor folder in an editor of your choice and make changes as per below instructions according to the requirement:
  1. <add key=”logtoetl” value=”False” />
    • Change the value of logtoetl to True
    • <add key=”logtoetl” value=”True” /> It tells CDFMonitor to log the traces into an etl file
    • It tells CDFMonitor to log the traces into an etl file.
  1. <add key=”tracefile” value=”” />
    • Fill the tracefile value with CDFTraces.etl
    • <add key=”tracefile” value=”CDFTraces.etl” />
    • That’s the name of the trace file that we will parse in CDFControl for the purpose of debugging the issue. The trace file will be saved at %systemroot%\CDFMonitor folder. When you execute CDFMonitor, it copies CDFMonitor.exe and CDFMonitor.exe.config file from the current location to %systemroot%\CDFMonitor that’s why trace files are also created in the same folder.
  1. <add key=”logfilename” value=”cdfmonitor.csv” />
    • A log file cdfmonitor.csv is created at %systemroot%\CDFMonitor when CDFMonitor.exe is executed. CDFMonitor writes all Cdfmonitor console output to this log file. While the trace is in progress, you will notice that the size of this file will not increase, however, when CDFMonitor is stopped, data is written to this file. There is no need to modify the value of logfilename. Sample cdfmonitor.csv file:
CDFMonitor.csv file 1
  1. <add key=”logfileautoflush” value=”True” />
  2. <add key=”logfilemaxcount” value=”20″ />
  3. <add key=”logfilemaxsize” value=”10″ />
  4. <add key=”logfileoverwrite” value=”True” />
    • Leave/change the value of logfileautoflush to True or False, leave the value of logfilemaxcount to 20 or less, change the value of logfilemazsize to 100 and leave/change the value of logfileoverwrite to True or False.
    • <add key=”logfileautoflush” value=”True/False” />
    • <add key=”logfilemaxcount” value=”20/15/10” />
    • <add key=”logfilemaxsize” value=”100” />
    • <add key=”logfileoverwrite” value=”True/False” />
    • It means that once the first trace file (CDFTraces.0001.etl) is full (100MBs) then a new trace file (CDFTraces.0002.etl) will be created and once that file is full (100MBs) then another one will be created until CDFTraces.00020.etl. If the trace is still running then CDFMonitor will start trimming logs in the trace files to accommodate for the newer logs. CDFMonitor will also start deleting and renaming trace files.
    • Here is a sample output from cdfmonitor.csv file where logfileautoflush is set to True, logfilemaxcount is set to 2, logfilemaxsize is set to 5 and logfileoverwrite is set to True:
CDFMonitor.csv file 2
  1. <add key=”tmfserver” value= “http://ctxsym.citrix.com/tmfs/xaxd/” />
    • Change the value of tmfserver to E:\Citrix\Citrix Supportability Pack\Tools\CDF Control\TMFs\XAXD
    • <add key=”tmfserver” value= “E:\Citrix\Citrix Supportability Pack\Tools\CDF Control\TMFs\XAXD”>
    • That’s the path to the folder that contains TMF files. If you don’t specify this path then TMF files will be downloaded from http://ctxsym.citrix.com/tmfs/xaxd/
  1. <add key=”modules” value=”.”/>
    • Fill the value in modules with Module GUIDs that you want to collect the traces for. Period or Dot (.) means all modules. Below screenshot is from CDFControl opened on a Delivery Controller
    • To find the GUID, open CDFControl as an Administrator, select modules and click on Tools > Create CTL File
    • Give the CTL file a name and click on Save
    • Open the file in Notepad and copy-paste GUIDs in to <add key=”modules” value=”.”/>
    • <add key=”modules” value=”{afd9c7ad-72dd-911c-fec8-5749caf5b6e2; 74980d0f-17d7-3210-72ba-e73c4fd27faf; 2f89267a-22b1-e58e-e48c-ce0a5c037363; 6f2643ca-53f4-49b6-a3bc-f52da217156f; 2759262c-2476-4b9c-910e-b5d73d3149c3; 72d02e9f-1dcc-47f8-b913-3bd634d33642; 95dd05f5-66ed-d12a-5082-7c0052e8d54f; 4fa9c1f6-4847-43d9-b17d-6fb2a0f8ab1b; 62411704-4de9-5cdf-65e1-e84a75acce58; 82bb1497-586e-5b66-7ec3-736f10f9a388; db15f1f5-8b05-5196-2a65-39e3d001a555; eda7e813-ffc2-5752-fc5c-bceb52610768; 5d2d015d-60d5-f372-362d-c3188a5f8d25; 279b3fb9-d73e-99db-6f24-dff01d8acc01;5306cf78-9438-ee07-ac4a-22230ac0813a; 7c347f2e-4261-bf29-3768-11c0b8ea6405; 3e73e007-5fba-08c8-6727-5ab470a4820a; b3d69e28-6333-58be-8bf3-fab6b826e956; b5d7789b-cafa-299b-f996-f65c93bf2874; d2a5ff70-5e2c-b16c-db91-8a4b888ec8f9; 0febe49a-6a8d-10a0-caea-ad39510614fc; addbae6b-5a41-c312-83df-89964101638e}” />
CDFControl Enter module name or select a binary file
Modules on Citrix Delivery Controllers
CDFControl Create CLT File
Create CTL File
CDFControl save CTL file
Save CTL File
CDFControl Module GUIDs
Modules and GUIDs
  1. My final CDFMonitor.exe.config file on Delivery Controllers looks like this:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v4.0.30319" />
<supportedRuntime version="v4.5" />
</startup>
<appSettings>
<add key="allowsingleinstance" value="True" />
<add key="buffermax" value="80" />
<add key="buffermin" value="40" />
<add key="buffersize" value="100" />
<add key="configfile" value= "" />
<add key="debug" value= "False" />
<add key="editor" value= "False" />
<add key="eventcommand" value="" />
<add key="eventcommandwait" value="False" />
<add key="eventmaxcount" value="0" />
<add key="eventthrottle" value="0" />
<add key="hidden" value="False" />
<add key="logfileautoflush" value="True" />
<add key="logfilemaxcount" value="20" />
<add key="logfilemaxsize" value="100" />
<add key="logfilename" value="cdfmonitor.csv" />
<add key="logfileoverwrite" value="True" />
<add key="loglevel" value="16" />
<add key="logmatchdetail" value="False" />
<add key="logmatchonly" value="False" />
<add key="logtoconsole" value="True" />
<add key="logtoetl" value="True" />
<add key="modules" value="{afd9c7ad-72dd-911c-fec8-5749caf5b6e2; 74980d0f-17d7-3210-72ba-e73c4fd27faf; 2f89267a-22b1-e58e-e48c-ce0a5c037363; 6f2643ca-53f4-49b6-a3bc-f52da217156f; 2759262c-2476-4b9c-910e-b5d73d3149c3; 72d02e9f-1dcc-47f8-b913-3bd634d33642; 95dd05f5-66ed-d12a-5082-7c0052e8d54f; 4fa9c1f6-4847-43d9-b17d-6fb2a0f8ab1b; 62411704-4de9-5cdf-65e1-e84a75acce58; 82bb1497-586e-5b66-7ec3-736f10f9a388; db15f1f5-8b05-5196-2a65-39e3d001a555; eda7e813-ffc2-5752-fc5c-bceb52610768; 5d2d015d-60d5-f372-362d-c3188a5f8d25; 279b3fb9-d73e-99db-6f24-dff01d8acc01;5306cf78-9438-ee07-ac4a-22230ac0813a; 7c347f2e-4261-bf29-3768-11c0b8ea6405; 3e73e007-5fba-08c8-6727-5ab470a4820a; b3d69e28-6333-58be-8bf3-fab6b826e956; b5d7789b-cafa-299b-f996-f65c93bf2874; d2a5ff70-5e2c-b16c-db91-8a4b888ec8f9; 0febe49a-6a8d-10a0-caea-ad39510614fc; addbae6b-5a41-c312-83df-89964101638e}" />
<add key="regexpattern" value= "." />
<add key="remotemachines" value= "" />
<add key="shutdowncommand" value="" />
<add key="shutdowncommandwait" value="False" />
<add key="smtpserver" value="" />
<add key="smtpport" value="25" />
<add key="smtpsendto" value="" />
<add key="smtpsendfrom" value="" />
<add key="smtpsubject" value="" />
<add key="smtpuser" value="" />
<add key="smtppassword" value="" />
<add key="smtpssl" value="False" />
<add key="startupcommand" value="" />
<add key="startupcommandwait" value="False" />
<add key="tmfcachedir" value= "" />
<add key="tmfserver" value= "E:\Citrix\Citrix Supportability Pack\Tools\CDF Control\TMFs\XAXD”>
<add key="tracefile" value="CDFTraces.etl" />
<add key="urlfiles" value="" />
<add key="urlsite" value="" />
<add key="urluser" value=""/>
<add key="urlpassword" value=""/>
<add key="writeevent" value= "False" />
</appSettings>
</configuration>
  1. If you want to collect traces for the same purpose on multiple machines then you can simply copy paste the CDFMonitor.exe and CDFMonitor.exe.config files to those servers. If your purpose of collecting CDF traces is different on each VM then you need to add, reduce, or probably use all of the modules into the configuration file. I am trying to troubleshoot Reboot Schedule problem (Event ID 3105) therefore I am going to schedule CDF tracing on 2 Delivery Controllers and 2 VDAs (Multi-session OS) using different set of modules. For Delivery Controllers, I am going to use following modules:
How to schedule CDF Tracing
  1. For VDAs, I am going to use following modules:
CDFControl VDA Module GUIDs
  1. My final CDFMonitor.exe.config file on Multi-session VDAs looks like this
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v4.0.30319" />
<supportedRuntime version="v4.5" />
</startup>
<appSettings>
<add key="allowsingleinstance" value="True" />
<add key="buffermax" value="80" />
<add key="buffermin" value="40" />
<add key="buffersize" value="100" />
<add key="configfile" value= "" />
<add key="debug" value= "False" />
<add key="editor" value= "False" />
<add key="eventcommand" value="" />
<add key="eventcommandwait" value="False" />
<add key="eventmaxcount" value="0" />
<add key="eventthrottle" value="0" />
<add key="hidden" value="False" />
<add key="logfileautoflush" value="True" />
<add key="logfilemaxcount" value="20" />
<add key="logfilemaxsize" value="100" />
<add key="logfilename" value="cdfmonitor.csv" />
<add key="logfileoverwrite" value="True" />
<add key="loglevel" value="16" />
<add key="logmatchdetail" value="False" />
<add key="logmatchonly" value="False" />
<add key="logtoconsole" value="True" />
<add key="logtoetl" value="True" />
<add key="modules" value="{d076aeab-f744-4154-94e0-c64dd3f73bb6;a7cf7ac8-9f0b-443a-b725-4ba5913dc0b3;34ae9d0c-2362-467f-8075-c224ab3e9641;a6255942-36df-4900-b804-e9c3c6b716d5;cc773ba8-e14e-4d6c-bdb2-869ad45dc55f;e0737c7b-c7db-4b08-b1e3-058e291095bf;25f387ec-5daf-4851-a1ec-65659160bcc3;23d7edb8-0782-46c7-a823-69a52ecdcbf5;4d6aca3f-32c6-4512-98f9-a2323e3695b2;fca303e3-f5db-45d8-abdf-637248cd7c64;21bdb1e2-c7a4-441b-98e6-787cef937c52}" />
<add key="regexpattern" value= "." />
<add key="remotemachines" value= "" />
<add key="shutdowncommand" value="" />
<add key="shutdowncommandwait" value="False" />
<add key="smtpserver" value="" />
<add key="smtpport" value="25" />
<add key="smtpsendto" value="" />
<add key="smtpsendfrom" value="" />
<add key="smtpsubject" value="" />
<add key="smtpuser" value="" />
<add key="smtppassword" value="" />
<add key="smtpssl" value="False" />
<add key="startupcommand" value="" />
<add key="startupcommandwait" value="False" />
<add key="tmfcachedir" value= "" />
<add key="tmfserver" value= "E:\Citrix\Citrix Supportability Pack\Tools\CDF Control\TMFs\XAXD”>
<add key="tracefile" value="CDFTraces.etl" />
<add key="urlfiles" value="" />
<add key="urlsite" value="" />
<add key="urluser" value=""/>
<add key="urlpassword" value=""/>
<add key="writeevent" value= "False" />
</appSettings>
</configuration>
  1. There is one parameter in CDFMonitor.exe.config file (<add key=”remotemachines” value= “” />) that can be used to define servers like <add key=”remotemachines” value= “CTX-DDC01;CTX-DDC02;CTX-LBVM01;CTXLBVM06” /> for the purpose of collecting CDF traces on multiple machines but it doesn’t seem to work for me. Maybe I am doing something wrong; however, I have decided not to include it in this article. If you can make it work, please let me know.
  1. CDFControl has a very good GUI option to collect CDF traces on remote machines. Go to Tools > Remote Tracing. In Machine address, provide the name of servers and click on Add. On the right, click on Start, re-produce the issue and then click on Stop. Click on Finish. Go to CDFControl folder, you will see a folder by the name CDFControl_Remote_Traces. Inside that folder, there would be more folders corresponding to the name of the servers you added to Remote Tracing wizard. Inside those folder(s), you will find another folder CDFControl_log_date_time that will contain trace file (*.ETL).
CDFControl Remote Tracing
CDFControl Remote Tracing
CDFControl Remote Tracing start stop and finish
CDFControl Remote Tracing Add/Remove Servers
CDFControl Remote Tracing CDFControl_Remote_Traces
CDFControl_Remote_Traces Folder
CDFControl Remote Tracing server folders
CDFControl Remote Tracing Server Folders
CDFControl Remote Traces
CDFControl Remote Traces
  1. We are good to create scheduled tasks now.

Create Scheduled Task to Schedule CDF Tracing

We need to create scheduled tasks on all servers where we want to collect CDF traces. Please ensure that you have copied over the CDFMonitor.exe and CDFMonitor.exe.config (with different GUIDs or similar to source) files.

We will create 2 scheduled tasks, one for starting CDFMonitor and another one for stopping CDFMonitor. Once CDF tracing is complete (CDFMonitor is stopped), you can visit %systemroot%\CDFMonitor folder anytime, copy all the files to some other location and execute CDFMonitor.exe /uninstallService command. This will remove Citrix CDF Monitor service from services.msc and remove CDFMonitor folder from C:\Windows (%systemroot%).

Citrix CDFMonitor service
  1. Open RUN > Taskschd.msc. Right click on Task Scheduler Library and select New Folder. Provide a name such as CDF Tracing and click on OK
Windows Task Scheduler Create New folder
Windows Task Scheduler folder name
  1. Right click on CDF Tracing and select Create a Task
Windows Task Scheduler create task
  1. In General Tab, provide a Name and Description (optional)
  2. Check Run whether user is logged on or not
  3. Check Run with highest privileges
Windows Task Scheduler Run with highest privileges
  1. In Trigger Tab, click on New. Define Start date and time. Make sure that Expiration date and timeis defined. Also, ensure that Enabled is checked. Click on OK.
Windows Task Scheduler Create Trigger
  1. In Actions Tab, click on New. In Action, select Start a program from the drop down. In Program/script, define the path where CDFMonitor.exe and CDFMonitor.exe.config file is saved. In Add arguments, write /installservice. Click on OK.
How to schedule CDF Tracing
  1. Leave the Condition tab as is or make changes according to your requirements.
Windows Task Scheduler Conditions
  1. Leave the Settings tab as is or make changes according to your requirements. I changed the value of Stop the task if runs longer than to 4 hours.
Windows Task Scheduler settings
  1. Click on OK. It may prompt you to provide the password of the user that be used to run this task.
  2. Scheduled task to start the trace at a certain time has been created. It’s time to create another task in the same Library to stop the trace. Just like previous task, give it a name, description, check “Run whether user is logged on or not” and check “Run with highest privileges” in General tab
Windows Task Scheduler General tab
  1. Set the Trigger. I am going to run the trace for 2 hours.
Windows Task Scheduler Trigger tab
  1. In Actions, the argument will /stopservice
Windows Task Scheduler Actions tab
  1. No changes in Conditions and Settings
  2. Finally, you would have 2 Scheduled tasks – One to start the trace and another one to stop the trace
Windows Task Scheduler Tasks
  1. Create Scheduled tasks following the same procedure on other servers. Alternatively, you can export scheduled tasks on one server and then import those tasks on another server.

Recommended Reading

Be the first to reply

Leave a Reply