# Heroku 로그

## 개요

Panther가 수집합니다 [Heroku 런타임 로그](https://devcenter.heroku.com/articles/logging#runtime-logs) 다음을 구성하여 [Heroku 로그 드레인](https://devcenter.heroku.com/articles/log-drains#https-drains) 이벤트를 Panther에 게시하기 위해 [HTTP 소스](https://docs.panther.com/ko/data-onboarding/data-transports/http).

## Heroku 런타임 로그를 Panther에 온보딩하는 방법

### 필수 조건

* 이 과정의 2단계( Heroku에서 로그 드레인 생성)를 완료하려면 Heroku의 CLI가 설치되어 있어야 합니다. 아직 설치되어 있지 않다면 다음을 따르세요 [여기에서 Heroku 문서를 참고하여 설치하세요](https://devcenter.heroku.com/articles/heroku-cli#install-the-heroku-cli).

### 1단계: Panther에 새 Heroku 소스 생성

1. Panther Console의 왼쪽 탐색 표시줄에서 **구성** > **Log Sources.**
2. 다음을 클릭하세요. **새로 만들기**.
3. “Heroku”를 검색한 다음 해당 타일을 클릭합니다.
   * 슬라이드아웃 패널에서 **전송 메커니즘** 오른쪽 상단의 드롭다운이 다음 값으로 미리 채워집니다. **HTTP** 옵션.
4. 다음을 클릭하세요. **설정 시작**.\\

   <figure><img src="https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-9d7402e56ba8d1a2f57946c7d2f6c052ddc8d109%2FScreenshot%202023-07-11%20at%201.49.04%20PM.png?alt=media" alt="The new source setup page for Heroku is shown in the Panther Console. The Transport Mechanism dropdown field is has a value of &#x22;HTTP&#x22; pre-selected. To its right is a Start Setup button."><figcaption></figcaption></figure>
5. 다음을 따르세요. [HTTP Source를 구성하기 위한 Panther의 지침](https://docs.panther.com/ko/data-onboarding/data-transports/http).
   * 이 로그 소스를 처음 설정할 때 **Auth method** 를 **None**. 아래 3단계에서 Heroku에서 인증 토큰을 가져온 후 Shared Secret 인증으로 변경하게 됩니다.
   * 이 소스로 전송된 페이로드는 다음의 적용을 받습니다. [모든 HTTP 소스에 대한 페이로드 요구 사항](https://docs.panther.com/ko/data-transports/http#payload-requirements).
   * HTTP 엔드포인트 생성이 완료될 때까지 다음 단계로 진행하지 마세요.

### 2단계: Heroku에서 새 로그 드레인 생성

이 단계를 시작하기 전에 [필수 조건이](#prerequisite) 충족되었는지 확인하세요.

1. Heroku 앱에서 Panther의 HTTP 소스로 향하는 로그 드레인을 설정하려면 Heroku CLI에서 다음 명령의 사용자 지정 버전을 실행하세요:\
   `heroku drains:add https://logs.mypantherdomain.runpanther.net/http/1081f021-a983-4dae-bcbb-1952ffaa4e72 -a myherokuappname`
2. 드레인 토큰을 가져오려면 다음 명령을 실행하세요:\
   `heroku drains --json -a myherokuappname`
   * 이 명령의 출력에서 다음 값의 값을 저장하세요 `토큰`. 이는 다음 단계에서 사용됩니다.

### 3단계: Panther에서 로그 소스 보안 설정

1. Panther 콘솔로 돌아갑니다.
2. 다음을 클릭하여 1단계에서 생성한 로그 소스를 찾습니다 **구성** > **로그 소스**을 클릭한 다음 소스 이름을 클릭합니다.
3. 오른쪽 상단에서 다음을 클릭하세요. **구성**의 가장 높은 패치 버전으로 업그레이드한 다음, **편집**.
4. 오른쪽 상단 모서리에서 다음을 클릭하세요 **보안** 탭.
5. 다음의 값을 변경하세요 **Auth method** 드롭다운을 다음으로 **Shared Secret**로 변경한 다음 다음 필드의 값을 입력하세요:
   * **헤더 이름**: 입력 `Logplex-Drain-Token`.
   * **Shared Secret Value**: 다음을 붙여넣으세요 `토큰` 이전 단계에서 Heroku CLI로부터 가져온 값입니다.
6. 다음을 클릭하세요. **저장**.

## 지원되는 로그 유형

### Heroku.Runtime

`Heroku.Runtime` 로그는 Heroku의 이벤트 로그로, 앱, 시스템, API 및 애드온 로그를 포함합니다. 자세한 내용은 다음을 참조하세요 [Heroku의 런타임 로그 문서.](https://devcenter.heroku.com/articles/logging#runtime-logs)

```yaml
schema: Heroku.Runtime
parser:
  fastmatch:
    match:
      - '%{message_len} <%{priority}>%{version} %{timestamp} %{host_name} %{app_name} %{process_id} %{message_id} %{message}'
    emptyValues:
      - '-'
description: 앱 코드와 종속성에서 생성된 로그를 포함하여 애플리케이션 자체의 로깅 출력과 시스템 및 API 로그입니다.
referenceURL: https://devcenter.heroku.com/articles/logging#runtime-logs
fields:
  - name: message_len
    type: int
  - name: priority
    type: int
  - name: version
    type: string
  - 이름: timestamp
    type: timestamp
    timeFormats:
      - rfc3339
    isEventTime: true
  - name: host_name
    type: string
    indicators:
      - hostname
  - 이름: app_name
    type: string
  - name: process_id
    type: string
  - 이름: message_id
    type: string
  - name: message
    type: string
```
