# Envoy 로그

## 개요

Panther는 수집을 지원합니다 [Envoy 액세스](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage) 를 스트리밍하여 로그를 [HTTP 소스](/ko/data-onboarding/data-transports/http.md)에 전달한 후, [Fluent Bit.](https://docs.fluentbit.io/manual/)

## Envoy 로그를 Panther에 온보딩하는 방법

### 1단계: Panther에 새 Envoy 로그 소스 생성

1. Panther Console의 왼쪽 탐색 표시줄에서 **구성** > **Log Sources를 클릭합니다.**
2. 을 클릭합니다 **새로 만들기**.
3. "Envoy"를 검색한 다음 해당 타일을 클릭합니다.
   * 슬라이드아웃 패널에서 **전송 메커니즘** 오른쪽 상단의 드롭다운은 다음 옵션으로 미리 채워집니다. **HTTP** 옵션.
4. 을 클릭합니다 **Start Setup**.
5. Panther의 [HTTP Source 구성 지침을 따라](/ko/data-onboarding/data-transports/http.md#how-to-set-up-an-http-log-source-in-panther)5단계부터 시작합니다.
   * 다음을 설정할 때 **인증 방식** 소스에 대해 다음을 사용하는 것을 권장합니다. [**Shared Secret**](/ko/data-onboarding/data-transports/http.md#shared-secret). 헤더 이름과 값은 3단계에서 필요하므로 안전한 위치에 저장하세요.
   * 이 소스로 전송되는 페이로드는 다음의 적용을 받습니다. [모든 HTTP 소스에 대한 페이로드 요구사항](/ko/data-onboarding/data-transports/http.md#payload-requirements).
   * HTTP 엔드포인트 생성이 완료될 때까지 다음 단계로 진행하지 마세요.

### 2단계: Envoy 로깅 구성

{% hint style="info" %}
필드를 추가하거나 제거하여 Envoy 로그를 사용자 지정할 수는 있지만, Panther의 [Envoy.Access 스키마](#envoy.access) 는 기본 로그 형식을 지원하도록 설계되었습니다. 분류 실패를 방지하려면 로그 구성에 기본 형식을 사용하세요.
{% endhint %}

1. 다음을 추가하여 `envoy.yml` 구성 파일을 수정하세요:
   * 루트 수준에서 관리 액세스 로깅을 활성화하려면 다음 스니펫을 추가하세요:

     ```yaml
     admin:
       access_log_path: "access.log"
     ```
   * resources 섹션 내에서 액세스 로깅을 활성화하려는 각 리소스에 다음 스니펫을 추가하세요:

     ```yaml
      access_log:
      - name: envoy.access_loggers.file
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
          path: "access.log"
     ```

{% hint style="info" %}
액세스 로그 파일 경로를 사용자 지정하는 경우(`access.log` 위), Fluent Bit 구성에서도 적절한 위치를 가리키도록 하세요.
{% endhint %}

2. 다음 명령을 실행하여 Envoy 프록시를 다시 시작하고, 업데이트된 구성 파일을 가리키도록 하세요. `envoy -c envoy.yml`.

### 3단계: 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)을 만들고 다음 필드를 설정하세요:

   * `[INPUT]` variables:
     * **Name:** 다음으로 설정: `tail`.
     * **Path**: 로그 파일의 경로로 설정합니다.
     * **Parser**: 다음으로 설정하세요. `envoy`.
   * `[OUTPUT]` variables:
     * **Host**: Panther URL을 입력하세요.
       * 예시: `logs.instance-name.runpanther.net`
     * **URI**: 이 프로세스의 1단계에서 생성된 HTTP Source 수집 URL의 끝부분을 입력하세요. 다음으로 시작합니다. `/http/`.
       * 예시: `/http/cb015ee4-543c-4489-9f4b-testaa16d7a`
     * **Header**: 1단계에서 Panther Console에서 HTTP 소스를 구성할 때 생성한 헤더 이름과 생성한 비밀 키를 입력하세요.
     * **Format**: 다음으로 설정하세요. `json_lines`
     * **Name**: 다음으로 설정하세요. `http`.
     * **TLS**: 다음으로 설정하세요. `ON`.
     * **Port**: 다음으로 설정하세요. `443`.

   ```editorconfig
   [SERVICE]
       Flush      1
   [INPUT]
       이름       tail
       # 이 경로는 envoy.yml 구성에 따라 다릅니다
       Path       /var/log/envoy/access.log
       Parser     envoy

   [OUTPUT]
       이름       http
       Match      *
       Host       logs.pre-alpha.runpanther.net
       Port       443
       URI        /http/6897ec53-9c4c-4fc7-a8c8-faf7b29571de
       # x-sender-header 이름이 헤더 이름과 일치하는지 확인하세요
       # Panther에서 HTTP 소스를 생성할 때 제공한
       Header     x-sender-header {YOUR_SECRET_HERE}
       Format     json_lines
       TLS        On
       TLS.Verify On
   ```
3. 새 구성 파일의 경로와 `parsers.conf` 파일의 경로를 전달하여 Fluent Bit를 시작하세요. 해당 `envoy` 파서는 Fluent Bit와 함께 제공되는 기본 파서 구성에 포함되어 있습니다.
   * 예시: `fluent-bit -c fluent.conf -R /var/etc/fluent-bit/parsers.conf`

## 지원되는 로그 유형

### Envoy.Access

다음은 Envoy 액세스 로그 스키마를 정의합니다:

```yaml
schema: Envoy.Access
description: FluentBit를 사용한 HTTP를 통한 Envoy 액세스 로그
필드:
  - name: start_time
    description: 요청의 시작 시간.
    유형: timestamp
    timeFormats:
      - rfc3339
    isEventTime: true
  - name: method
    description: GET, POST 등과 같은 HTTP 요청 메서드.
    유형: string
  - name: path
    description: 요청의 URI 경로.
    유형: string
  - name: protocol
    description: HTTP 프로토콜 버전.
    유형: string
  - name: code
    description: 응답의 HTTP 상태 코드.
    유형: string
  - name: response_flags
    description: 응답과 관련된 추가 플래그.
    유형: string
  - name: bytes_received
    description: 클라이언트로부터 수신한 바이트 수.
    유형: string
  - name: bytes_sent
    description: 클라이언트에게 전송한 바이트 수.
    유형: string
  - name: duration
    description: 요청의 총 소요 시간.
    유형: string
  - name: x_envoy_upstream_service_time
    description: 업스트림 서비스에서 소요된 시간.
    유형: string
  - name: x_forwarded_for
    description: X-Forwarded-For 헤더(있는 경우).
    유형: string
  - name: user_agent
    description: 요청 헤더의 사용자 에이전트 문자열.
    유형: string
  - name: request_id
    description: 요청 ID 헤더 값.
    유형: string
  - name: authority
    description: authority 헤더 값.
    유형: string
  - name: upstream_host
    description: 요청에 대해 선택된 업스트림 호스트.
    유형: string
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.panther.com/ko/data-onboarding/supported-logs/envoy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
