채널 정의

이벤트는 이벤트 로그 채널, 이벤트 추적 로그 파일 또는 둘 다에 기록할 수 있습니다. 채널은 기본적으로 이벤트를 수집하는 싱크입니다. 이벤트의 대상 그룹이 Windows 이벤트 뷰어 같은 이벤트 소비자를 사용하는 경우 이벤트를 수집하거나 다른 공급자가 정의한 기존 채널을 가져올 새 채널을 정의해야 합니다.

고유한 채널을 정의하려면 채널 요소를 사용합니다. 가져온 채널을 정의하려면 importChannel 요소를 사용합니다. 정의한 가져온 채널 또는 채널의 조합으로 최대 8개의 채널을 지정할 수 있습니다.

채널은 관리, 운영, 분석 및 디버그의 네 가지 유형 중 하나여야 합니다. 각 채널 유형에는 채널에 쓰는 이벤트의 유형을 결정하는 대상 그룹이 있습니다. 각 형식에 대한 설명은 ChannelType 복합 형식을 참조하세요.

이벤트가 기록되는 채널을 지정하려면 이벤트 정의의 채널 특성을 채널 정의의 chid 특성과 동일한 값으로 설정합니다. 이벤트는 한 번에 하나의 채널에만 기록할 수 있지만 최대 7개의 다른 ETW 세션에서 동시에 수집할 수도 있습니다.

다음 예제에서는 채널을 가져오는 방법을 보여 줍니다. chidname 특성을 설정해야 합니다. chid 특성은 채널을 고유하게 식별합니다. 채널 목록의 각 채널 식별자는 고유해야 합니다. 이름 특성을 공급자가 채널을 정의할 때 사용한 것과 동일한 이름으로 설정합니다.

<instrumentationManifest
    xmlns="http://schemas.microsoft.com/win/2004/08/events" 
    xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    >

    <instrumentation>
        <events>
            <provider name="Microsoft-Windows-SampleProvider" 
                guid="{1db28f2e-8f80-4027-8c5a-a11f7f10f62d}" 
                symbol="PROVIDER_GUID" 
                resourceFileName="<path to the exe or dll that contains the metadata resources>" 
                messageFileName="<path to the exe or dll that contains the string resources>"
                message="$(string.Provider.Name)">

                <channels>
                    <channel chid="c1"
                             name="Microsoft-Windows-BaseProvider/Admin"
                             symbol="CHANNEL_BASEPROVIDER_ADMIN"
                             type="Admin"/>
                </channels>

                . . .

            </provider>
        </events>
    </instrumentation>

    <localization>
        <resources culture="en-US">
            <stringTable>
                <string id="Provider.Name" value="Microsoft-Windows-SampleProvider"/>
            </stringTable>
        </resources>
    </localization>

</instrumentationManifest>

Winmeta.xml 가져올 수 있는 레거시 채널을 정의하지만 레거시 채널(예: 애플리케이션 또는 시스템)에서 이벤트를 사용하는 레거시 소비자를 지원하지 않는 한 사용하지 않아야 합니다. Winmeta.xml 파일은 Windows SDK에 포함되어 있습니다.

다음 예제에서는 채널을 정의하는 방법을 보여 줍니다. chid, nametype 특성을 설정해야 합니다. chid 특성은 채널을 고유하게 식별합니다. 채널 목록의 각 채널 식별자는 고유해야 합니다. chid 특성을 공급자가 나열하는 채널에 고유한 값으로 설정합니다. 채널 식별자는 하나 이상의 이벤트 정의에서 참조됩니다. 채널 이름을 지정하는 규칙은 공급자 이름채널 형식 형식 형식에서 공급자 이름 및 채널 형식/ 사용하는 것입니다.

<instrumentationManifest
    xmlns="http://schemas.microsoft.com/win/2004/08/events" 
    xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    >

    <instrumentation>
        <events>
            <provider name="Microsoft-Windows-SampleProvider"
                guid="{1db28f2e-8f80-4027-8c5a-a11f7f10f62d}"
                symbol="PROVIDER_GUID"
                resourceFileName="<path to the exe or dll that contains the metadata resources>"
                messageFileName="<path to the exe or dll that contains the string resources>"
                message="$(string.Provider.Name)">

                <channels>
                    <importChannel chid="c1"
                                   name="Microsoft-Windows-BaseProvider/Admin"
                                   symbol="CHANNEL_BASEPROVIDER_ADMIN"
                                   />

                    <channel chid="c2"
                             name="Microsoft-Windows-SampleProvider/Operational"
                             type="Operational"
                             enabled="true"
                             />
                </channels>

                . . .

            </provider>
        </events>
    </instrumentation>

    <localization>
        <resources culture="en-US">
            <stringTable>
                <string id="Provider.Name" value="Microsoft-Windows-SampleProvider"/>
            </stringTable>
        </resources>
    </localization>

</instrumentationManifest>