# Docker 로그

## 개요

Panther는 다음을 수집하는 것을 지원합니다 [Docker 이벤트](https://docs.docker.com/engine/reference/commandline/events/) 이를 스트리밍하여 로그 [HTTP 소스](https://docs.panther.com/ko/data-onboarding/data-transports/http) 전달된 후에 [Fluent Bit.](https://docs.fluentbit.io/manual/)

## Docker 이벤트를 Panther에 온보딩하는 방법

### 1단계: Panther에서 새로운 Docker Events 로그 소스 생성

1. Panther 콘솔의 왼쪽 탐색 바에서 클릭하세요 **구성** > **로그 소스.**
2. 를 선택하고 Panther가 설치된 계정 ID를 입력하십시오. **새로 만들기**.
3. "Docker Events"를 검색한 다음 해당 타일을 클릭하세요.
   * 슬라이드 아웃 패널에서 **전송 메커니즘** 우측 상단의 드롭다운은 미리 채워진 상태일 것입니다 **HTTP** 옵션.
4. 를 선택하고 Panther가 설치된 계정 ID를 입력하십시오. **설정 시작**.\
   ![In the new log source onboarding flow in the Panther Console, the Docker Events page is shown. The "Transport Mechanism" dropdown has a value of "HTTP," and 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-6927f28a036ffd191e4ea1467aee2752b2a4c4b5%2FScreenshot%202023-07-31%20at%203.31.46%20PM.png?alt=media)
5. Panther의 [HTTP 소스 구성에 대한 지침을 따르세요](https://docs.panther.com/ko/data-transports/http#how-to-set-up-an-http-log-source-in-panther)5단계부터 시작하여.
   * 설정할 때 **인증 방법** 소스에 대해, 우리는 [**공유 비밀(Shared Secret)**](https://docs.panther.com/ko/data-transports/http#shared-secret).
   * 이 소스로 전송된 페이로드는 다음의 적용을 받습니다 [모든 HTTP 소스에 대한 페이로드 요구사항](https://docs.panther.com/ko/data-transports/http#payload-requirements).
   * HTTP 엔드포인트 생성이 완료될 때까지 다음 단계로 진행하지 마세요.

HTTP 소스를 생성한 후 Panther 콘솔은 HTTP 소스 URL을 표시합니다. 다음 단계에서 필요하니 이 값을 안전한 위치에 보관하세요.

### 2단계: 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).
   * 아래의 Linux 및 macOS 샘플 구성 파일을 참조하세요. [예제 구성 파일](#example-configuration-files).
3. 새 구성 파일 경로를 전달하여 Fluent Bit을 시작하십시오.
   * 다음의 경로를 반드시 포함해야 합니다 `parser.conf` 파일에는 다음이 포함되어 있습니다 `docker` 파서를 포함합니다. 이는 fluent-bit에 기본으로 포함됩니다. Linux에서는 다음 위치에서 찾을 수 있습니다 `/etc/fluent-bit/parsers.conf`.
     * 예: `fluent-bit -c fluentbit.conf -R /etc/fluent-bit/parsers.conf`

#### 예제 구성 파일

{% tabs %}
{% tab title="Linux" %}
Fluent Bit 구성 파일에 다음을 구성하세요:

* `[INPUT]` 변수:
  * **이름**: 이를 다음으로 설정하세요 `docker_events`.
  * **파서**: 이를 다음으로 설정하세요 `docker`.
* `[OUTPUT]` 변수:
  * **호스트**: Panther URL을 입력하세요.
    * 예: `logs.instance-name.runpanther.net`
  * **URI**: HTTP Source 수집 URL의 끝부분(이 프로세스의 1단계에서 생성된)을 입력하세요. 이것은로 시작합니다 `/http/`.
    * 예: `/http/cb015ee4-543c-4489-9f4b-testaa16d7a`
  * **헤더**: Panther 콘솔에서 1단계에서 HTTP 소스를 구성할 때 생성한 헤더 이름과 생성한 시크릿을 입력하세요.
  * **이름**: 다음으로 설정 `http`.
  * **TLS**: 다음으로 설정 `켜기`.
  * **포트**: 다음으로 설정 `443`.

```editorconfig
[SERVICE]
  flush      1

[INPUT]
  name       docker_events
  parser     docker

[OUTPUT]
  name       http
  match      *
  host       logs.instance.runpanther.net
  port       443
  URI        /http/70c55034-13f1-4e08-a018-test5f2bb0a8
  Header     x-panther-secret {YOUR_SECRET_HERE}
  Format     json_lines
  TLS        on
  TLS.Verify on
```

{% endtab %}

{% tab title="macOS" %}
Fluent Bit 구성 파일에 다음을 구성하세요:

* `[INPUT]` 변수:
  * **이름**: 이를 다음으로 설정하세요 `docker_events`.
    * macOS에서는, `docker_events` fluent-bit에서 지원되지 않습니다. 대신에 다음을 사용할 수 있습니다 [Exec 입력 플러그인](https://docs.fluentbit.io/manual/pipeline/inputs/exec)아래의 macOS 샘플 구성을 참조하세요.
  * **파서**: 이를 다음으로 설정하세요 `docker`.
* `[OUTPUT]` 변수:
  * **호스트**: Panther URL을 입력하세요.
    * 예: `logs.instance-name.runpanther.net`
  * **URI**: HTTP 소스 URL의 끝부분을 입력하세요(이 프로세스의 1단계에서 생성된), 다음으로 시작합니다 `/http/`.
    * 예: `/http/cb015ee4-543c-4489-9f4b-testaa16d7a`
  * **헤더**: Panther 콘솔에서 1단계에서 HTTP 소스를 구성할 때 생성한 헤더 이름과 생성한 시크릿을 입력하세요.
  * **이름**: 다음으로 설정 `http`.
  * **TLS**: 다음으로 설정 `켜기`.
  * **포트**: 다음으로 설정 `443`.

```editorconfig
[SERVICE]
  flush      1

[INPUT]
  name         exec
  parser       docker
  Command      docker events --since 10s --until 0s --format '{{json .}}'
  Interval_Sec 10

[OUTPUT]
  name       http
  match      *
  host       logs.instance.runpanther.net
  port       443
  URI        /http/70c55034-13f1-4e08-a018-2c005f2bb0a8
  Header     x-panther-secret {YOUR_SECRET_HERE}
  Format     json_lines
  TLS        on
  TLS.Verify on
```

{% endtab %}
{% endtabs %}

## 지원되는 로그 유형

### Docker.Events

다음은 Docker events 로그 스키마를 정의합니다:

```yaml
schema: Docker.Events
description: 컨테이너, 이미지, 네트워크 및 볼륨에 대한 시스템 수준 관리 작업을 감사하기 위한 Docker 이벤트
referenceURL: https://docs.docker.com/engine/reference/commandline/events/
필드:
  - 이름: status
    description: 이 이벤트 작업의 상태를 나타내는 문자열
    type: string
  - 이름: id
    description: 이벤트 ID
    type: string
  - name: from
    description: 이벤트가 발생한 출처의 컨텍스트
    type: string
  - name: Type
    description: 조작 대상 객체의 유형입니다. 객체 유형 목록은 참조를 참조하세요
    type: string
  - name: Action
    description: 수행된 액션입니다. 유형에 따라 가능한 액션이 다릅니다. 이벤트 유형 목록은 참조를 참조하세요
    type: string
  - 이름: Actor
    description: 이벤트를 수행하는 액터입니다. Docker의 맥락에서는 반드시 최종 사용자일 필요는 없으며 컨테이너 자체일 수 있습니다
    type: object
    필드:
      - name: ID
        description: 액터 ID
        type: string
        지표:
          - actor_id
      - name: Attributes
        description: 이벤트별 세부사항
        유형: json
  - name: scope
    description: 이벤트 유형에 따라 다른 범위를 가집니다. 로컬 범위 이벤트는 발생한 노드에서만 보이며, 스웜 범위 이벤트는 모든 매니저에서 보입니다.
    type: string
  - 이름: time
    required: true
    description: 이벤트가 발생한 시간(유닉스 초)
    type: timestamp
    timeFormats:
      - unix
    isEventTime: true
  - name: timeNano
    description: 나노초 단위의 이벤트 시간
    type: string
```
