在 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 server 角色元件。The providers map directly to Lync Server server role components in the Lync Server tracing model. 提供者會定義將要追蹤的 Lync Server 2013 元件、郵件類型 (例如,要收集的郵件類型、嚴重、錯誤、警告) ,以及旗標 (例如 TF _ Connection 或 tf the _) 。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 server role 中可追蹤的元件。Providers are the traceable components in each Lync Server server role. 藉由使用提供者,可讓您定義在元件上追蹤的層級和類型 (例如 S4、SIPStack、IM 和目前狀態)。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) role 此 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. 在下列目錄中,您可以使用 \ \ \ Microsoft Lync Server 2013 CLSAgent 中的目錄 C: Program Files 通用檔案中所 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    針對已定義的提供者,收集類型為嚴重、錯誤、警告和資訊的所有追蹤訊息。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 _Connection     提供連線相關的記錄專案。TF_Connection   Provides connection-related log entries. 這些記錄檔包含與特定元件建立之連接的相關資訊。These logs include information about connections established to and from a particular component. 這也可能包括大量的網路層級資訊 (,也就是針對不含 connection) 概念的元件。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 _通訊協定     提供通訊協定和組合的群組編解碼器封包訊息。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 _ Protocol。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 程序加以定義。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 為記錄類型、設定為調試的層級,而旗標為 TF _ CONNECTION 和 tf the _ 。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.