# Windows 이벤트 로그

## 개요

Panther는 Windows 이벤트 로그를 수집할 수 있도록 지원합니다. [HTTP 소스](https://docs.panther.com/ko/data-onboarding/data-transports/http)로 전달한 후, [Fluent Bit.](https://docs.fluentbit.io/manual/)

## Panther에 Windows 이벤트 로그를 온보딩하는 방법

### 1단계: Panther에서 새 Windows 이벤트 로그 소스를 생성합니다

1. Panther Console의 왼쪽 탐색 표시줄에서 **구성** > **Log Sources.**
2. 다음을 클릭하세요. **새로 만들기**.
3. “Windows Event Logs”를 검색한 다음 해당 타일을 클릭합니다.
   * 슬라이드아웃 패널에서 **전송 메커니즘** 오른쪽 상단의 드롭다운이 다음 값으로 미리 채워집니다. **HTTP** 옵션.
4. 다음을 클릭하세요. **설정 시작**.\
   ![On the new log source setup page, the Windows Event Logs tile has been selected, and a slide out panel is shown. In the Transport Mechanism dropdown field, HTTP is selected. To its right is a Start Setup button.](https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-62f6ffbdf62d420d25b82de52f863643c8da0154%2FScreenshot%202023-07-19%20at%202.43.36%20PM.png?alt=media)
5. Panther의 [HTTP Source 구성 지침을 따라](https://docs.panther.com/ko/data-transports/http#how-to-set-up-an-http-log-source-in-panther)5단계부터 시작합니다.
   * 소스의 **Auth method** 를 설정할 때는 다음 사용을 권장합니다. [**Shared Secret**](https://docs.panther.com/ko/data-transports/http#shared-secret).
   * 이 소스로 전송된 페이로드는 다음의 적용을 받습니다. [모든 HTTP 소스에 대한 페이로드 요구 사항](https://docs.panther.com/ko/data-transports/http#payload-requirements).

HTTP 소스를 생성한 후 Panther Console에 HTTP Source URL이 표시됩니다. 이 값은 다음 단계에서 필요하므로 안전한 위치에 저장하세요.

### 2단계: Windows에서 Fluent Bit 구성하기

1. 다음을 따르세요. [Fluent Bit 시작하기 안내](https://docs.fluentbit.io/manual/installation/getting-started-with-fluent-bit) 를 사용하여 Fluent Bit를 서비스로 설치합니다.
2. 새 [Fluent Bit 구성 파일](https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/classic-mode/configuration-file). 다음을 참조하세요. [아래 예시](#fluent-bit-configuration-file-examples) System 및 Security 로그 스트리밍 또는 Sysmon 로그 스트리밍을 구성하는 방법은
   * 반드시 `winevtlog`. 다른 모듈은 더 이상 사용되지 않으며 작동하지 않습니다.
   * Windows Server 2012를 사용하는 경우, `Use_ANSI True` 가 필요할 수 있습니다.
   * 1단계에서 **JSON** 를 HTTP Source의 **Stream Type**, `OUTPUT` 섹션에서 설정했다면, `Format` 값을 `json_lines`.
3. 새 구성 파일 경로를 전달하여 Fluent Bit를 시작합니다.
   * 매번 머신이 시작될 때 Fluent Bit을 Daemon으로 실행하려면 [Windows Service 지침](https://docs.fluentbit.io/manual/installation/windows#windows-service-support).

#### Fluent Bit 구성 파일 예시

{% tabs %}
{% tab title="System 및 Security 로그" %}
**System 및 Security 로그 수집**

Fluent Bit 구성 파일에서 다음을 설정하세요:

* `[INPUT]` 변수:
  * **Channels**: 다음으로 설정 `System,Security`
* `[OUTPUT]` 변수:
  * **호스트**로 설정: Panther URL을 입력합니다.
    * 예시: `logs.instance-name.runpanther.net`
  * **URI**로 설정: HTTP Source 수집 URL의 끝부분을 입력합니다(이 절차의 1단계에서 생성됨). 시작 부분은 `/http/`.
    * 예시: `/http/cb015ee4-543c-4489-9f4b-testaa16d7a`
  * **Header**로 설정: 1단계에서 Panther Console의 HTTP 소스를 구성할 때 만든 헤더 이름과 생성한 시크릿을 입력합니다.
  * **이름**: 다음으로 설정 `http`.
  * **TLS**: 다음으로 설정 `ON`.
  * **포트**: 다음으로 설정 `443`.

```editorconfig
[SERVICE]
    Flush 5
    Daemon off
    Log_Level info

[INPUT]
    Name         winevtlog
    Channels     System,Security
    Interval_Sec 1
    DB           winevtlog.sqlite

[OUTPUT]
    Name         http
    Match        *
    Host         logs.instance-name.runpanther.net
    Port         443
    URI          /http/cb015ee4-543c-4489-9f4b-testaa16d7a
    Header       x-sender-header {YOUR_SECRET_HERE}
    Format       json_lines
    TLS          On
    TLS.Verify   On
```

{% endtab %}

{% tab title="Sysmon 로그" %}
**Sysmon 로그 수집**

1. 구성 `sysmon.exe` 다음을 따라 [SwiftOnSecurity의 가이드](https://github.com/SwiftOnSecurity/sysmon-config).
   * 이 프로세스는 Fluent Bit이 Panther로 전송할 Windows 이벤트 로그를 생성합니다.
2. Fluent Bit 구성 파일에서 다음을 설정하세요:
   * `[INPUT]` 변수:
     * **Channels**: 다음으로 설정 `Microsoft-Windows-Sysmon/Operational`
   * `[OUTPUT]` 변수:
     * **호스트**로 설정: Panther URL을 입력합니다.
       * 예시: `logs.instance-name.runpanther.net`
     * **URI**로 설정: HTTP Source 수집 URL의 끝부분을 입력합니다(이 절차의 1단계에서 생성됨). 시작 부분은 `/http/`.
       * 예시: `/http/cb015ee4-543c-4489-9f4b-testaa16d7a`
     * **Header**로 설정: 1단계에서 Panther Console의 HTTP 소스를 구성할 때 만든 헤더 이름과 생성한 시크릿을 입력합니다.
     * **이름**: 다음으로 설정 `http`.
     * **TLS**: 다음으로 설정 `ON`.
     * **포트**: 다음으로 설정 `443`.

```editorconfig
[SERVICE]
    Flush 5
    Daemon on
    Log_Level info

[INPUT]
    Name         winevtlog
    Channels     Microsoft-Windows-Sysmon/Operational
    Interval_Sec 1
    DB           winevtlog.sqlite

[OUTPUT]
    Name         http
    Match        *
    Host         logs.instance-name.runpanther.net
    Port         443
    URI          /http/cb015ee4-543c-4489-9f4b-testaa16d7a
    Header       x-sender-header {YOUR_SECRET_HERE}
    Format       json_lines
    TLS          On
    TLS.Verify   On
```

{% endtab %}
{% endtabs %}

## 지원되는 로그 유형

### Windows.EventLogs

```yaml
schema: Windows.EventLogs
description: Windows 이벤트 로그
referenceURL: https://learn.microsoft.com/en-us/windows/win32/wes/eventschema-elements
fields:
  - name: ProcessID
    description: 이벤트를 생성한 프로세스를 식별합니다.
    type: string
  - name: ThreadID
    description: 이벤트를 생성한 스레드를 식별합니다.
    type: string
  - name: TimeCreated
    description: 이벤트가 기록된 시점을 식별하는 타임스탬프입니다.
    type: timestamp
    timeFormats:
      - '%Y-%m-%d %H:%M:%S %z'
    isEventTime: true
  - name: EventID
    description: 공급자가 이벤트를 식별하는 데 사용한 식별자입니다.
    type: string
  - name: ProviderName
    description: 이벤트를 기록한 이벤트 공급자의 이름입니다.
    type: string
  - name: ProviderGuid
    description: 공급자를 고유하게 식별하는 전역 고유 식별자입니다.
    type: string
  - name: Qualifiers
    description: 레거시 공급자는 이벤트를 식별하는 데 32비트 숫자를 사용합니다. 이벤트가 레거시 공급자에 의해 기록된 경우, EventID 요소의 값에는 이벤트 식별자의 하위 16비트가 포함되고 Qualifier 속성에는 이벤트 식별자의 상위 16비트가 포함됩니다.
    type: string
  - name: Version
    description: 이벤트 정의의 버전 번호입니다.
    type: string
  - name: Level
    description: 이벤트에 정의된 심각도 수준입니다.
    type: string
  - name: Task
    description: 이벤트에 정의된 작업입니다. Task와 opcode는 일반적으로 이벤트가 기록된 애플리케이션 내 위치를 식별하는 데 사용됩니다.
    type: string
  - name: Opcode
    description: 이벤트에 정의된 opcode입니다. Task와 opcode는 일반적으로 이벤트가 기록된 애플리케이션 내 위치를 식별하는 데 사용됩니다.
    type: string
  - name: Keywords
    description: 이벤트에 정의된 키워드의 비트마스크입니다. 키워드는 이벤트 유형을 분류하는 데 사용됩니다(예: 데이터 읽기와 관련된 이벤트).
    type: string
  - name: EventRecordID
    description: 이벤트가 기록될 때 할당된 레코드 번호입니다.
    type: string
  - name: ActivityID
    description: 현재 활동을 식별하는 전역 고유 식별자입니다. 이 식별자로 게시된 이벤트는 동일한 활동의 일부입니다.
    type: string
    indicators:
      - trace_id
  - name: RelatedActivityID
    description: 제어가 전달된 활동을 식별하는 전역 고유 식별자입니다. 관련 이벤트는 이후 이 식별자를 ActivityID 식별자로 갖게 됩니다.
    type: string
  - name: Channel
    description: 이벤트가 기록된 채널입니다.
    type: string
  - name: Computer
    description: 이벤트가 발생한 컴퓨터의 이름입니다.
    type: string
    indicators:
      - username
  - name: UserID
    description: 문자열 형식의 사용자의 보안 식별자(SID)입니다.
    type: string
    indicators:
      - username
  - name: Message
    description: 이벤트의 렌더링된 메시지 문자열입니다.
    type: string
  - name: StringInserts
    description: 임의의 이벤트별 데이터 목록입니다. fluent-bit에 의해 생성됩니다.
    type: json
  - name: ExtraEventData
    description: Message 필드에서 추출된 추가 Key Value 쌍 맵입니다. 이는 구조화된 쿼리/디택션 작성을 쉽게 할 수 있도록 Panther가 추가한 필드입니다.
    type: json
```
