在 Lync Server 2013 中配置集中日志记录服务的提供程序Configuring providers for Centralized Logging Service in Lync Server 2013

 

上次修改的主题: 2014-03-19Topic Last Modified: 2014-03-19

集中日志记录服务中 提供程序 的概念和配置是最重要的一项。The concepts and configuration of providers in Centralized Logging Service is one of the most important to grasp. 提供程序直接映射到 lync server 跟踪模型中的 lync server 服务器角色组件。The providers map directly to Lync Server server role components in the Lync Server tracing model. 提供程序定义要跟踪的 Lync Server 2013 的组件、要收集的邮件的类型、要收集的) 的 (、严重、错误或警告,以及 flags (例如,TF _ Connection 或 TF settings _) 。The provider defines the components of a Lync Server 2013 that will be traced, the type of messages (for example, fatal, error, or warning) to collect, and the flags (for example, TF_Connection or TF_Diag). 提供程序是每个 Lync Server 服务器角色中的可跟踪组件。Providers are the traceable components in each Lync Server server role. 通过使用提供程序,可以定义对组件进行的跟踪的级别和类型(例如,S4、SIPStack、IM 和 Presence)。By using providers, you define the level and type of tracing on components (for example, S4, SIPStack, IM and Presence). 可在方案中使用所定义的提供程序将针对给定逻辑集合的、满足某个特定问题条件的所有提供程序组合在一起。The defined provider is used in a scenario to group all of the providers for a given logical collection that address a specific problem condition.

若要使用 Lync Server 命令行管理程序运行集中式日志记录服务功能,您必须是 CsAdministrator 或 CsServerAdministrator 基于角色的访问控制 (RBAC) 安全组的成员,或者是包含这两个组中任一组的自定义 RBAC 角色。To run the Centralized Logging Service functions using the Lync Server Management Shell, you must be a member of either the CsAdministrator or the CsServerAdministrator role-based access control (RBAC) security groups, or a custom RBAC role that contains either of these two groups. 若要返回所有基于角色的访问控制的列表 (RBAC) 角色已将此 cmdlet 分配给 (包括您自己创建的任何自定义 RBAC 角色) ,请从 Lync Server 命令行管理程序或 Windows PowerShell 提示符处运行以下命令:To return a list of all the role-based access control (RBAC) roles this cmdlet has been assigned to (including any custom RBAC roles you have created yourself), run the following command from the Lync Server Management Shell or the Windows PowerShell prompt:

Get-CsAdminRole | Where-Object {$_.Cmdlets -match "Lync Server 2013 cmdlet"}

例如:For example:

Get-CsAdminRole | Where-Object {$_.Cmdlets -match "Set-CsClsConfiguration"}

本主题的其余部分将重点说明如何定义提供程序、修改提供程序以及提供程序定义为优化您的疑难解答所包含的内容。The remainder of this topic focuses on how to define providers, modify a provider and what a provider definition contains to optimize your troubleshooting. 有两种方法可以发出集中式日志记录服务命令。There are two ways to issue Centralized Logging Service commands. 默认情况下,您可以使用目录 C: \ Program files \ Common files The \ Microsoft Lync Server 2013 CLSAgent 中的 CLSController.exe \ 。You can use the CLSController.exe that is located, by default, in the directory C:\Program Files\Common Files\Microsoft Lync Server 2013\CLSAgent. 或者,您可以使用 Lync Server 命令行管理程序发出 Windows PowerShell 命令。Or, you can use the Lync Server Management Shell to issue Windows PowerShell commands. 重要区别在于,在命令行中使用 CLSController.exe 时,可供选择的可用方案是有限的,在这些方案中,提供程序已被定义且不可更改,但您可以定义日志级别。The important distinction is that when you use CLSController.exe at the command line there is a finite selection of scenarios available in which the providers are already defined and are not changeable, but you can define the log level. 通过使用 Windows PowerShell,可以定义在日志记录会话中使用的新提供程序,并能够完全控制自己的创建、收集的内容以及它们收集数据的级别。By using Windows PowerShell, you can define new providers for use in your logging sessions, and have complete control over their creation, what they collect, and at what level they collect data.

重要

如前所述,提供程序的功能十分强大。但是,方案的功能更为强大,因为方案是对提供程序表示的组件进行设置并执行跟踪所需的所有信息的具体体现。由于方案将包含一组提供程序,因此将运行一个包含几百条用于收集大量信息的命令的批处理文件与在命令行中一次性发出几百条命令相比是不受限制的。As mentioned, providers are very powerful. However, scenarios are more powerful because they contain the embodiment of all information needed to set and execute tracing on the components that the providers represent. With scenarios being a collection of providers, this could be loosely compared to running a batch file containing hundreds of commands to collect a lot of information versus issuing hundreds of commands, one at a time, at the command line.
集中日志记录服务提供了许多已为您定义的方案,而不是要求您深入了解提供程序的详细信息。Instead of requiring you to dig deeply into the details of providers, the Centralized Logging Service provides a number of scenarios that are already defined for you. 提供的方案涵盖了绝大多数您可能会遇到的问题。The provided scenarios cover the vast majority of possible issues that you will encounter. 在极少数情况下,您可能需要创建和定义提供程序并将其分配给方案。In rare cases, you may need to create and define providers and assign them to scenarios. 强烈建议您先熟悉提供的每个方案,然后再调查有关创建新的提供程序和方案的需求。We strongly recommend that you become familiar with each of the scenarios provided before you investigate the need to create new providers and scenarios. 虽然您可以通过此处提供的有关创建提供程序的信息来熟悉方案如何使用提供程序元素来收集跟踪信息,但此时不提供有关提供程序本身的详细信息。While information about creating providers is found here to familiarize you with how the scenarios use the provider elements to collect trace information, details on the providers themselves are not provided at this time.

Lync Server 2013 中的集中日志记录服务概述中,定义在方案中使用的提供程序的关键元素包括:Introduced in Overview of the Centralized Logging Service in Lync Server 2013, the key elements of defining a provider for use in a scenario are:

  • 提供程序    如果您熟悉 OCSLogger,则提供程序是您选择的组件,用于告诉 OCSLogger 跟踪引擎应从什么方面收集日志。Providers   If you are familiar with OCSLogger, providers are the components that you choose to tell OCSLogger what the tracing engine should collect logs from. 提供程序是一些相同的组件,在许多情况下,它们的名称与 OCSLogger 中组件的名称相同。The providers are the same components, and in many cases have the same name as the components in OCSLogger. 如果您不熟悉 OCSLogger,则提供程序是集中式日志记录服务可从中收集日志的特定于服务器角色的组件。If you are not familiar with OCSLogger, providers are server-role specific components that the Centralized Logging Service can collect logs from. 在集中日志记录服务的情况下,CLSAgent 是集中日志记录服务的体系结构部分,该组件将跟踪您在提供程序配置中定义的组件。In the case of the Centralized Logging Service, the CLSAgent is the architectural part of the Centralized Logging Service that is doing the tracing of the components that you define in the providers configuration.

  • 日志记录级别    OCSLogger 提供了选择收集的数据的多个级别的详细信息的选项。Logging levels   OCSLogger provided the option to choose a number of levels of detail for the data collected. 此功能是集中日志记录服务和方案不可或缺的一部分,由 Type 参数定义。This feature is an integral part of the Centralized Logging Service and scenarios, and is defined by the Type parameter. 您可以选择以下选项:You can choose from the following:

    • 所有    将类型为致命、错误、警告和信息的跟踪消息收集到定义的提供程序的日志中。All   Collects trace messages of type fatal, error, warning, and info to the log for the defined provider.

    • 致命    仅收集指示定义的提供程序发生故障的跟踪消息。Fatal   Collects only the trace messages that indicate a failure for the defined provider.

    • 错误    仅收集指示定义的提供程序的错误以及致命消息的跟踪消息。Error   Collects only the trace messages that indicate an error for the defined provider, plus fatal messages.

    • 警告    仅收集指示定义的提供程序的警告的跟踪消息,以及致命错误和错误消息。Warning   Collects only the trace messages that indicate a warning for the defined provider, plus fatal and error messages.

    • 信息    仅收集指示定义的提供程序的信息性消息的跟踪消息,以及致命错误和警告消息。Info   Collects only the trace messages that indicate an informational message for the defined provider, plus fatal, error, and warning messages.

    • 详细    收集定义的提供程序的所有类型为致命错误、错误、警告和信息的跟踪消息。Verbose   Collects all trace messages of type fatal, error, warning and info for the defined provider.

  • 标志    OCSLogger 提供了选择每个提供程序的标记的选项,这些提供程序定义了可从跟踪文件中检索的信息类型。Flags   OCSLogger provided the option to choose flags for each provider that defined what type of information you could retrieve from the trace files. 可以根据提供程序选择以下标志:You can chose the following flags, based on the provider:

    • TF _连接     提供与连接相关的日志条目。TF_Connection   Provides connection-related log entries. 这些日志包括与特定组件建立的连接的相关信息。These logs include information about connections established to and from a particular component. 这可能还包括大量网络级信息(即针对组件,但不包括连接的概念)。This may also include significant network-level information (that is, for components without the concept of a connection).

    • TF _安全性     提供与安全性相关的所有事件/日志条目。TF_Security   Provides all events/log entries related to security. 例如,对于 SipStack,它们是一些安全事件(例如,域验证失败和客户端身份验证/授权失败)。For example, for SipStack, these are security events such as domain validation failure, and client authentication/authorization failures.

    • TF _诊断     提供可用于诊断或排除组件故障的诊断事件。TF_Diag   Provides diagnostics events that you can use to diagnose or troubleshoot the component. 例如,对于 SipStack,它们是证书失败或 DNS 警告/错误。For example, for SipStack, these are certificate failures, or DNS warnings/errors.

    • TF _协议     提供协议消息,如 SIP 和组合的社区编解码器包消息。TF_Protocol   Provides protocol messages such as SIP and Combined Community Codec Pack messages.

    • TF _组件     可在指定为提供程序的一部分的组件上启用日志记录。TF_Component   Enables logging on the components specified as part of the providers.

    • 所有    设置可用于提供程序的所有可用标志。All   Sets all available flags available for the provider.

查看有关现有集中日志记录服务方案提供程序的信息To review information about existing Centralized Logging Service scenario providers

  1. 启动 Lync Server 命令行管理程序:依次单击“开始”****、“所有程序”****、“Microsoft Lync Server 2013”**** 和“Lync Server 命令行管理程序”****。Start the Lync Server Management Shell: Click Start, click All Programs, click Microsoft Lync Server 2013, and then click Lync Server Management Shell.

  2. 若要查看现有提供程序的配置,请键入:To review the configuration of existing providers, type the following:

    Get-CsClsScenario -Identity <scope and scenario name> 
    

    例如,若要查看有关全局会议助理的信息,请键入:For example, to review information about the global conferencing attendant, type:

    Get-CsClsScenario -Identity "global/CAA"
    

    此命令显示具有关联的标志、设置和组件的提供程序的列表。The command displays a list of providers with the associated flags, settings, and components. 如果显示的信息不足,或者列表对默认 Windows PowerShell 列表格式来说太长,则可以通过定义不同的输出方法来显示其他信息。If the information displayed is not enough or the list is too long for the default Windows PowerShell list format, you can display additional information by defining a different output method. 为此,请键入:To do this, type:

    Get-CsClsScenario -Identity "global/CAA" | Select-Object -ExpandProperty Provider
    

    此命令的输出显示用五行格式显示的每个提供程序,以及提供程序名称、日志记录类型、日志记录级别、标志、GUID 和角色(每个提供程序位于一个单独的行上)。The output of this command displays each provider displayed in a five line format with the provider name, type of logging, logging level, flags, GUID, and role, each one on a separate line.

定义新的集中日志记录服务方案提供程序To define a new Centralized Logging Service scenario provider

  1. 启动 Lync Server 命令行管理程序:依次单击“开始”****、“所有程序”****、“Microsoft Lync Server 2013”**** 和“Lync Server 命令行管理程序”****。Start the Lync Server Management Shell: Click Start, click All Programs, click Microsoft Lync Server 2013, and then click Lync Server Management Shell.

  2. 方案提供程序包含要跟踪的组件、要使用的标志和要收集的详细信息级别。通过键入以下内容可完成此操作:A scenario provider consists of a component to trace, flags to use, and a level of detail to collect. You do this by typing:

    $<variableName> = New-CsClsProvider -Name <provider component> -Type <log type> -Level <log level detail type> -Flags <provider trace log flags>
    

    例如,定义要从 Lyss 提供程序收集的内容和详细信息级别的跟踪提供程序定义与以下内容类似:For example, a trace provider definition that defines what to collect and to what level of detail from the Lyss provider looks like the following:

    $LyssProvider = New-CsClsProvider -Name "Lyss" -Type "WPP" -Level "Info" -Flags "All"
    

–Level 收集重要消息、错误消息、警告消息和信息性消息。The –Level collects fatal, error, warning, and information messages. 使用的标志都是为 Lyss 提供程序定义的所有标志,并包括 TF _ Connection、tf _ 诊断和 tf _ 协议。The flags used are all of those defined for the Lyss provider, and include TF_Connection, TF_Diag and TF_Protocol.

在定义变量 $LyssProvider 之后,可将其与 New-CsClsScenario cmdlet 结合使用以从 Lyss 提供程序中收集跟踪信息。After the variable $LyssProvider is defined, you can use it with the New-CsClsScenario cmdlet to collect traces from the Lyss provider. 若要创建提供程序并将其分配给新的方案,请键入:To complete the creation and assignment of the provider to a new scenario, type:

New-CsClsScenario -Identity "site:Redmond/RedmondLyssInfo" -Provider $LyssProvider

其中 $LyssProvider 是包含使用 New-CsClsProvider 创建的定义的方案的变量。Where $LyssProvider is the variable containing the defined scenario created with New-CsClsProvider.

更改现有的集中日志记录服务方案提供程序To change an existing Centralized Logging Service scenario provider

  1. 启动 Lync Server 命令行管理程序:依次单击“开始”****、“所有程序”****、“Microsoft Lync Server 2013”**** 和“Lync Server 命令行管理程序”****。Start the Lync Server Management Shell: Click Start, click All Programs, click Microsoft Lync Server 2013, and then click Lync Server Management Shell.

  2. 若要更新或更改现有提供程序的配置,请键入:To update or change the configuration of an existing provider, type:

    $LyssProvider = New-CsClsProvider -Name "Lyss" -Type "WPP" -Level "Debug" -Flags "TF_Connection, TF_Diag"
    

    然后,通过键入以下内容来更新方案以分配提供程序:You then update the scenario to assign the provider by typing the following:

    Set-CsClsScenario -Identity "site:Redmond/RedmondLyssInfo" -Provider $LyssProvider
    

此命令的最终结果是方案 site:Redmond/RedmondLyssInfo 将获得提供程序的更新标志和级别。The end result of the command is that the scenario site:Redmond/RedmondLyssInfo will have updated flags and level for the provider assigned to it. 可通过使用 Get-CsClsScenario 查看新方案。You can view the new scenario by using Get-CsClsScenario. 有关详细信息,请参阅 Get-CsClsScenarioFor details, see Get-CsClsScenario.

警告

New-ClsCsProvider 不会检查以确定标志是否有效。New-ClsCsProvider does not check to determine whether the flags are valid. 请确保标志(例如,TF_DIAG 或 TF_CONNECTION)的拼写正确。Make sure that the spelling of the flags (for example, TF_DIAG or TF_CONNECTION) is spelled correctly. 如果标志的拼写不正确,则提供程序无法返回预期日志信息。If the flags are not spelled correctly, the provider cannot return the expected log information.

若要将其他提供程序添加到此方案,请键入:If you want to add additional providers to this scenario, type the following:

Set-CsClsScenario -Identity "site:Redmond/RedmondLyssInfo" -Provider @{Add=$ABSProvider, $CASProvider, S4Provider}

其中,将通过已使用 New-CsClsProvider 过程定义的 Add 指令来定义每个提供程序。Where each provider defined with the Add directive has already been defined using the New-CsClsProvider process.

删除方案提供程序To remove a scenario provider

  1. 启动 Lync Server 命令行管理程序:依次单击“开始”****、“所有程序”****、“Microsoft Lync Server 2013”**** 和“Lync Server 命令行管理程序”****。Start the Lync Server Management Shell: Click Start, click All Programs, click Microsoft Lync Server 2013, and then click Lync Server Management Shell.

  2. 可利用提供的 cmdlet 更新现有提供程序并创建新的提供程序。The cmdlets provided allow you to update existing providers and create new providers. 若要删除提供程序,您必须对 Set-CsClsScenario 的 Provider 参数使用 Replace 指令。To remove a provider, you must use the Replace directive for the Provider parameter to Set-CsClsScenario. 完全删除提供程序的唯一方式是,将提供程序替换为具有相同名称的重定义的提供程序并使用 Update 指令。The only way to completely remove a provider is to replace it with a redefined provider of the same name and use the Update directive. 例如,我们的提供商 LyssProvider 使用 WPP 作为日志类型进行定义,将 level 设置为 Debug,而 flags set 为 TF _ CONNECTION 和 TF settings _ 。For example, our provider LyssProvider is defined with WPP as the log type, level set to Debug, and flags set are TF_CONNECTION and TF_DIAG. 您需要将标志更改为“All”。You need to change the flags to “All”. 若要更改提供程序,请键入:To change the provider, type the following:

    $LyssProvider = New-CsClsProvider -Name "Lyss" -Type "WPP" -Level "Debug" -Flags "All"
    

     

    Set-CsClsScenario -Identity "site:Redmond/RedmondLyssInfo" -Provider @{Replace=$LyssProvider}
    
  3. 若要完全删除方案及其关联的提供程序,请键入:If you want to completely remove a scenario and the providers associated with it, type the following:

    Remove-CsClsScenario -Identity <scope and name of scenario>
    

    例如:For example:

    Remove-CsClsScenario -Identity "site:Redmond/RedmondLyssInfo"
    

    警告

    cmdlet Remove-CsClsScenario 不会提示您进行确认。The cmdlet Remove-CsClsScenario does not prompt you for confirmation. 方案将连同已分配给它的提供程序一起被删除。The scenario is deleted, along with the providers that were assigned to it. 可通过重新运行最初用于创建方案的命令来重新创建方案。You can recreate the scenario by re-running the commands used to create it initially. 没有用于恢复已删除的方案或提供程序的过程。There is no procedure to recover removed scenarios or providers.

在使用 Remove-CsClsScenario cmdlet 删除一个方案时,可以从作用域中完全删除此方案。When you remove a scenario by using the Remove-CsClsScenario cmdlet, you completely remove the scenario from the scope. 若要使用已创建的方案以及作为该方案的一部分的提供程序,可以创建新的提供程序并将其分配给新方案。To use the scenarios that you created and the providers that were a part of the scenario, you create new providers and assign them to a new scenario.