Lync 2013 Centralized Logging Service (CLS) Scenarios

Since Centralized Logging is completely new concept in  Lync 2013, the available material on MSFT websites and all around the Internet is not very extensive.

This is how it works

  • The ClsAgent runs on each Lync 2013 servers and waits for command to start, stop and search the traces according to a scenario. Also it delivers the results to the CLS controller. See this article.
  • Scenarios define which Lync components (providers) at which Level and Flags will capture traces.
  • There are default scenarios and custom scenarios. See this article for more details about the default scenarios.
  • Custom scenarios can be created with the command New-CsClsScenario.
  • To create a scenario, provider configurations have to be created and added to the scenario: New-CsClsProvider
  • To create a provider configuration you need to know what components are available for tracing. To get the list of them you need to see the file “c:\Program Files\Common Files\Microsoft Lync Server 2013\Tracing\default.xml
    Here is a little PowerShell script to list those providers:

    [xml]$providers = Get-Content "$env:ProgramFiles\Common Files\Microsoft Lync Server 2013\Tracing\default.xml"
    $providers.ComponentInfo.Components.Component
  • Save the script as get-LyncLogProviders.ps1 and run it to list the component names:
    .\get-LyncLogProviders.ps1 | Select-Object name
  • If you want to see the available trace levels and flags for a certain provider/component (here Autodiscover) :
    .\get-LyncLogProviders.ps1 | Where-Object {$_.Name -eq "Autodiscover"} | Select-Object -ExpandProperty Levels | Select-Object -ExpandProperty Level
    .\get-LyncLogProviders.ps1 | Where-Object {$_.Name -eq "Autodiscover"} | Select-Object -ExpandProperty Flags | Select-Object -ExpandProperty Flag
  • Now you know the provider name and what levels you can or should set up for the new CLS trace provider. Now you can create a new trace provider configuration and a new scenario.:
    $provider = New-CsClsProvider -Name "AutoDiscover" -Type "WPP" -Level "Verbose" -Flags "TF_COMPONENT"
    New-CsClsScenario -Identity "global/AutoDiscover_by_Attila" -Provider $provider
  • It’s time to start tracing with the new scenario. You can sync the traces to write the captured trace to the files on the servers, you can also stop the trace if you don’t need it anymore. You can start tracing on a specific server or pool, see the Technet article.
    Start-CsClsLogging -Scenario "AutoDiscover_by_Attila"
    Sync-CsClsLogging
    Stop-CsClsLogging -Scenario "AutoDiscover_by_Attila"
  •  Now you probably have what you wanted to capture, but you need to collect those from the Lync servers and save it to a file. If you only want to see the trace of a component, you have to specify it in your search query. E.g.
    Search-CsClsLogging -Components "AutoDiscover" -OutputFilePath "C:\temp\logfile.log"

I’m not sure if the mentioned .xml file is the proper source of available providers/components. If you have better idea, please share it with me.

Share