본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Windows용 이벤트 추적 (Event tracing for Windows)

원문 보기 위키 갱신

Event Tracing for Windows (event_tracing_windows) 입력 플러그인은 실시간 Event Tracing for Windows (ETW) 이벤트를 수집해요.

출처: 문서

본문

지원 이벤트 유형: logs

Event Tracing for Windows (event_tracing_windows) 입력 플러그인은 실시간 Event Tracing for Windows (ETW) 이벤트를 수집해요.

이 플러그인을 사용해서 소비하고 싶은 Windows ETW 프로바이더를 정의할 수 있어요. 임의의 Windows 성능 카운터를 정의하는 것과 비슷하다고 보면 돼요. 이름이나 GUID로 프로바이더를 선택하고, ETW 레벨과 키워드 마스크를 조정하며, 디코딩된 이벤트 페이로드 필드를 Fluent Bit를 통해 수집할 수 있어요.

참고: 이 플러그인은 Windows 운영체제에서만 사용할 수 있어요. 일부 ETW 프로바이더와 시스템 로거 세션에는 관리자 권한이 필요할 수 있어요.

Configuration parameters (설정 매개변수)

이 플러그인은 다음 설정 매개변수를 지원해요:

Key Description Default
provider_guid ETW provider GUID to enable. Required for provider sessions unless provider_name is set. none
provider_name ETW provider name to resolve and enable. Required for provider sessions unless provider_guid is set. none
session_name ETW real-time session name. When session_type is system and this value is left as the default, the plugin uses NT Kernel Logger. fluent-bit-event-tracing-windows
session_type ETW session type. Use provider for a real-time provider consumer, or system for a Windows kernel logger session that uses kernel_flags. provider
stale_session_action Action when the ETW session already exists. Use stop to stop the existing session and retry, or fail to return an error without stopping it. stop
level ETW provider level. Valid values are 0 to 255. 5
match_any_keyword ETW MatchAnyKeyword mask. Decimal and hexadecimal values are accepted. 0xffffffffffffffff
match_all_keyword ETW MatchAllKeyword mask. Decimal and hexadecimal values are accepted. 0
kernel_flags Comma-separated kernel flags used with session_type system. Supported names are process, thread, image_load, cswitch, tcpip, disk_io. A numeric EVENT_TRACE_FLAG_* mask is also accepted. process,thread,image_load
buffer_size ETW session buffer size in kilobytes. Zero uses the Windows default. 64
minimum_buffers Minimum number of ETW session buffers. Zero uses the Windows default. 4
maximum_buffers Maximum number of ETW session buffers. Zero uses the Windows default. 32
flush_timer ETW session flush timer in seconds. Zero uses the Windows default. 1

provider 세션에서는 provider_guid, provider_name 둘 중 하나 또는 둘 다 설정하세요. 둘 다 설정하면, 확인된 프로바이더 이름이 설정된 GUID와 일치해야 해요.

system 세션에서는 provider_guid나 provider_name을 설정하지 마세요. Windows 커널 이벤트를 선택하려면 kernel_flags를 사용하세요.

세션 버퍼 메모리 상한은 buffer_size KB 곱하기 maximum_buffers예요. 기본값으로는 64 KB 곱하기 32, 즉 2048 KB가 상한이 돼요.

Event record fields (이벤트 레코드 필드)

각 ETW 이벤트는 ETW 타임스탬프와 함께 다음 필드를 가지는 로그 레코드로 내보내져요:

Field Description
provider_guid Provider GUID from the ETW event header.
provider_name Configured provider name, or null if unset.
event_id ETW event ID.
version ETW event version.
channel ETW event channel.
level ETW event level.
task ETW event task.
opcode ETW event opcode.
keywords ETW event keyword mask.
process_id Process ID from the ETW event header.
thread_id Thread ID from the ETW event header.
activity_id ETW activity ID.
related_activity_id Related activity ID when present, otherwise null.
payload Decoded top-level ETW payload fields as key-value data.

Configuration examples (설정 예시)

Provider name (프로바이더 이름)

다음 예시는 프로바이더 이름을 확인해서 Microsoft-Windows-Kernel-Process 프로바이더의 이벤트를 수집해요:

{% tabs %} {% tab title="fluent-bit.yaml" %}

pipeline:
  inputs:
    - name: event_tracing_windows
      tag: etw.process
      provider_name: Microsoft-Windows-Kernel-Process
      level: 5
      match_any_keyword: 0xffffffffffffffff

  outputs:
    - name: stdout
      match: '*'

{% endtab %}

{% tab title="fluent-bit.conf" %}

[INPUT]
    Name              event_tracing_windows
    Tag               etw.process
    Provider_Name     Microsoft-Windows-Kernel-Process
    Level             5
    Match_Any_Keyword 0xffffffffffffffff

[OUTPUT]
    Name  stdout
    Match *

{% endtab %} {% endtabs %}

Provider GUID

다음 예시는 GUID로 프로바이더를 선택해요:

{% tabs %} {% tab title="fluent-bit.yaml" %}

pipeline:
  inputs:
    - name: event_tracing_windows
      tag: etw.provider
      provider_guid: '{22fb2cd6-0e7b-422b-a0c7-2fad1fd0e716}'
      level: 5
      match_any_keyword: 0xffffffffffffffff
      match_all_keyword: 0

  outputs:
    - name: stdout
      match: '*'

{% endtab %}

{% tab title="fluent-bit.conf" %}

[INPUT]
    Name              event_tracing_windows
    Tag               etw.provider
    Provider_Guid     {22fb2cd6-0e7b-422b-a0c7-2fad1fd0e716}
    Level             5
    Match_Any_Keyword 0xffffffffffffffff
    Match_All_Keyword 0

[OUTPUT]
    Name  stdout
    Match *

{% endtab %} {% endtabs %}

Windows kernel events (Windows 커널 이벤트)

session_type system을 사용해서 Windows 커널 로거 이벤트를 수집하세요. 시스템 세션은 프로바이더 이름이나 GUID 대신 kernel_flags를 사용해요:

{% tabs %} {% tab title="fluent-bit.yaml" %}

pipeline:
  inputs:
    - name: event_tracing_windows
      tag: etw.kernel
      session_type: system
      kernel_flags: process,thread,image_load

  outputs:
    - name: stdout
      match: '*'

{% endtab %}

{% tab title="fluent-bit.conf" %}

[INPUT]
    Name         event_tracing_windows
    Tag          etw.kernel
    Session_Type system
    Kernel_Flags process,thread,image_load

[OUTPUT]
    Name  stdout
    Match *

{% endtab %} {% endtabs %}

Requirements and permissions (요구 사항과 권한)

Event Tracing for Windows 입력 플러그인은 Windows ETW 실시간 세션과 Trace Data Helper (TDH) API를 사용해요. 다음 요구 사항이 적용돼요:

  • 운영체제: Windows 전용.
  • 프로바이더 가용성: 설정된 provider_name이 호스트의 등록된 ETW 프로바이더에 존재해야 해요. provider_guid를 사용한다면 GUID가 유효한 ETW 프로바이더 GUID여야 해요.
  • 권한: Fluent Bit 프로세스가 ETW 세션을 시작하고 선택한 프로바이더를 활성화할 권한이 있어야 해요. 시스템 로거 세션과 일부 프로바이더는 Fluent Bit를 관리자로 실행해야 해요.

시작이 접근 오류로 실패한다면 Fluent Bit를 관리자 권한으로 실행하거나, 선택한 ETW 세션을 만들고 소비할 권한이 있는 서비스 계정을 사용하세요.

더 알아보기 (Learn more)