> For the complete documentation index, see [llms.txt](https://docs.panther.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.panther.com/ko/panther/pantherlog.md).

# pantherlog 도구

## 개요

사용할 수 있습니다 `pantherlog`, CLI 도구인 pantherlog를 사용해 Custom Logs를 다룰 수 있습니다. Panther가 관리하는 또는 [사용자 지정 스키마](/ko/data-onboarding/custom-log-types.md), 그리고 샘플 로그를 사용해 사용자 지정 스키마를 추론합니다.

대신 Panther Console에서 사용자 지정 로그를 다루는 방법은 다음을 참조하세요: [사용자 지정 로그](/ko/data-onboarding/custom-log-types.md) 문서.

### pantherlog 제한 사항

* 다음을 참조하세요: [infer 제한 사항](#infer-limitations) 및 [test 제한 사항](#test-limitations) 아래 섹션을 참고하세요.

## 다운로드

다음 링크에서 최신 버전을 다운로드하세요:

<table data-column-title-hidden data-view="cards"><thead><tr><th align="center"></th><th align="center"></th></tr></thead><tbody><tr><td align="center"><strong>Windows</strong></td><td align="center"><p><a href="https://panther-community-us-east-1.s3.amazonaws.com/latest/tools/windows-amd64-pantherlog.exe.zip">amd64</a></p><p><a href="https://panther-community-us-east-1.s3.amazonaws.com/latest/tools/windows-arm64-pantherlog.exe.zip">arm64</a></p></td></tr><tr><td align="center"><strong>Darwin/MacOS</strong></td><td align="center"><p><a href="https://panther-community-us-east-1.s3.amazonaws.com/latest/tools/darwin-amd64-pantherlog.zip">amd64</a> (Intel)</p><p><a href="https://panther-community-us-east-1.s3.amazonaws.com/latest/tools/darwin-arm64-pantherlog.zip">arm64</a> (Apple Silicon)</p></td></tr><tr><td align="center"><strong>Linux</strong></td><td align="center"><p><a href="https://panther-community-us-east-1.s3.amazonaws.com/latest/tools/linux-amd64-pantherlog.zip">amd64</a></p><p><a href="https://panther-community-us-east-1.s3.amazonaws.com/latest/tools/linux-arm64-pantherlog.zip">arm64</a></p></td></tr></tbody></table>

## `list-schemas`: Panther가 관리하는 스키마 목록 표시

pantherlog의 `list-schemas` 명령을 사용하여 Panther가 관리하는 스키마를 나열할 수 있습니다.

```
./pantherlog list-schemas
```

## `export-schemas`: Panther가 관리하는 스키마 내보내기

pantherlog의 `export-schemas` 명령을 사용하여 Panther가 관리하는 스키마를 로컬 디렉터리로 내보내거나 터미널에 출력할 수 있습니다.

### 스키마를 로컬 디렉터리로 내보내기

```
./pantherlog export-schemas --path directory-name
```

* 만약 `directory-name` 가 존재하지 않으면 생성됩니다.
* 참고로 `-p` 대신 사용할 수 있습니다 `--path`.

### 스키마 출력

스키마를 다음에 출력하려면 `표준 출력` 로컬 디렉터리로 내보내는 대신 대시(-)를 사용하세요.

```
./pantherlog export-schemas -p -
```

### 선택한 스키마 내보내기

다음을 사용하여 내보낼 스키마를 필터링할 수 있습니다 `-s` 옵션에 내보내려는 스키마 이름을 쉼표로 구분하여 지정하세요.

```
./pantherlog export-schemas --path ./managed-schemas -s 'AWS.ALB,Slack.AuditLogs'
```

## `infer`: JSON 로그 샘플로 스키마 생성

pantherlog를 사용해 다음 위치의 샘플 파일에서 스키마 파일을 생성할 수 있습니다 [줄바꿈으로 구분된 JSON](https://jsonlines.org/) 형식입니다. 도구는 제공된 로그를 검사하고 추론된 스키마를 다음에 출력합니다 `표준 출력`.

예를 들어, 로그의 스키마를 추론하려면 `sample_logs.jsonl` 그리고 출력하려면 `schema.yml`, 다음을 사용하세요:

```
$ ./pantherlog infer --name SchemaName sample_logs.jsonl > schema.yml
```

YAML 키와 값은 대소문자를 구분합니다. 도구는 여러 타임스탬프 형식을 추론하려고 시도합니다. 스키마 추론에 대해 자세한 내용은 다음을 참고하세요 [사용자 지정 로그](/ko/data-onboarding/custom-log-types.md#automatically-infer-the-schema-in-panther).

{% embed url="<https://www.loom.com/share/5479e9c46f914c03bff4da0464f30956>" %}
샘플 로그에서 스키마를 추론하는 워크플로
{% endembed %}

### `infer` 제한 사항

해당 `infer` 명령은 어떤 타임스탬프 필드도 `isEventTime:true`로 표시하지 않습니다. 적절한 `timestamp` 필드를 선택하여 `isEventTime:true`으로 표시하세요 `isEventTime:true`. 다음에 대한 자세한 내용은 [Log Schema Reference의 타임스탬프 섹션을 참조하세요](/ko/data-onboarding/custom-log-types/reference.md#timestamps).

해당 `infer` 명령은 다음 유형의 [식별자만 추론할 수 있습니다](/ko/search/panther-fields.md#indicator-fields): `ip`, `aws_arn`, `url`, `email`, `hash` 다이제스트(`MD5`, `SHA1` 및 `SHA2`), 그리고 `mac`. 필드를 검토하고 필요에 따라 더 많은 식별자를 추가하세요.

다음에서 생성된 스키마를 검토하는 것을 강력히 권장합니다 `infer` 명령으로 생성된 스키마를 프로덕션 환경에 배포하기 전에 적절히 편집하세요.

## `parse`: 스키마 검증

도구를 사용하여 스키마 파일을 검증하고 로그 파일을 파싱할 수 있습니다. 로그 파일의 이벤트는 줄바꿈으로 구분되어야 합니다. 처리된 로그는 다음에 기록되고 `표준 출력` 오류는 다음에 기록됩니다 `표준 오류`.

예를 들어, 다음의 로그를 파싱하려면 `sample_logs.jsonl` 다음의 로그 스키마로 `schema.yml`, 다음을 사용하세요:

```
$ ./pantherlog parse --path schema.yml --schemas Schema.Name sample_logs.jsonl
```

도구는 다음을 통해 입력도 받을 수 있습니다 `표준 입력` 따라서 파이프라인에서 사용할 수 있습니다:

```
$ cat sample_logs.jsonl | ./pantherlog parse --path schema.yml
```

## `test`: 스키마에 대한 테스트 실행

pantherlog를 사용해 사용자 지정 스키마에 대한 단위 테스트를 실행할 수 있습니다. 다음에 정의된 테스트를 실행하려면 `schema_tests.yml` 파일에 정의된 사용자 지정 스키마의 `schema.yml`, 다음을 실행합니다:

```
$ ./pantherlog test schema.yml schema_tests.yml
```

첫 번째 인수는 스키마 YAML 파일이 포함된 파일 또는 디렉터리입니다. 나머지 인수는 실행할 테스트 파일입니다. 테스트 파일 인수를 지정하지 않고 첫 번째 인수가 디렉터리인 경우, 도구는 다음 접미사를 가진 YAML 파일에서 테스트를 찾습니다 `_tests.yml` 또는 `_tests.yaml` 접미사.

### 스키마 테스트 파일 만들기

테스트 파일에 다음을 포함하세요 `input` 파싱할 이벤트가 들어 있는 `result` pantherlog `test` 명령은 스키마가 오류 없이 이벤트를 파싱할 수 있는지, 그리고 정규화된 이벤트가 예상 결과와 일치하는지 확인합니다.

{% hint style="info" %}
해당 `result` event에는 다음이 포함되어야 합니다 [Panther 표준 필드](/ko/search/panther-fields.md) 파싱 중 이벤트에 주입될 것으로 예상되는 항목(예: `p_log_type`.
{% endhint %}

다음에 유의하세요 [다음과 관련된 지침 `timeFormats` 스키마 테스트에서](/ko/data-onboarding/custom-log-types/reference.md#working-with-timeformats-in-schema-tests).

{% hint style="info" %}
하나의 스키마에 대해 여러 테스트를 작성하는 예시는 Panther의 Knowledge Base의 다음 문서를 참조하세요: [스키마에 대해 여러 pantherlog 테스트를 어떻게 작성할 수 있나요?](https://help.panther.com/Data_Sources/Custom_Logs/How_can_I_write_multiple_pantherlog_tests_for_a_schema%3F)
{% endhint %}

예:

{% tabs %}
{% tab title="schema\_tests.yml" %}

```json
# 스키마나 로그 유형 이름을 지을 때 camelCase를 사용하세요
name: 사용자 지정 로그 테스트 이름
logType: Custom.SampleLog.V1
input: |
  {
    "method": "GET",
    "path": "/-/metrics",
    "format": "html",
    "controller": "MetricsController",
    "action": "index",
    "status": 200,
    "params": [],
    "remote_ip": "1.1.1.1",
    "user_id": null,
    "username": null,
    "ua": null,
    "queue_duration_s": null,
    "correlation_id": "c01ce2c1-d9e3-4e69-bfa3-b27e50af0268",
    "cpu_s": 0.05,
    "db_duration_s": 0,
    "view_duration_s": 0.00039,
    "duration_s": 0.0459,
    "tag": "test",
    "time": "2019-11-14T13:12:46.156Z"
  }

result: |
  {
    "action": "index",
    "controller": "MetricsController",
    "correlation_id": "c01ce2c1-d9e3-4e69-bfa3-b27e50af0268",
    "cpu_s": 0.05,
    "db_duration_s": 0,
    "duration_s": 0.0459,
    "format": "html",
    "method": "GET",
    "path": "/-/metrics",
    "remote_ip": "1.1.1.1",
    "status": 200,
    "tag": "test",
    "time": "2019-11-14T13:12:46.156Z",
    "view_duration_s": 0.00039,
    "p_log_type": "Custom.SampleLog.V1",
    "p_row_id": "acde48001122a480ca9eda991001",
    "p_event_time": "2019-11-14T13:12:46.156Z",
    "p_parse_time": "2022-04-04T16:12:41.059224Z",
    "p_any_ip_addresses": [
        "1.1.1.1"
    ]
  }
```

{% endtab %}

{% tab title="schema.yml" %}

```yaml
version: 0
schema: Custom.SampleLog.V1
필드:
- name: action
  required: true
  유형: 문자열
- name: controller
  required: true
  유형: 문자열
- name: correlation_id
  required: true
  유형: 문자열
- name: cpu_s
  required: true
  유형: float
- name: db_duration_s
  required: true
  type: bigint
- name: duration_s
  required: true
  유형: float
- name: format
  required: true
  유형: 문자열
- name: method
  required: true
  유형: 문자열
- name: path
  required: true
  유형: 문자열
- name: remote_ip
  required: true
  유형: 문자열
  지표:
   - ip
- 이름: status
  required: true
  type: bigint
- name: tag
  required: false
  유형: 문자열
- name: time
  required: true
  유형: timestamp
  시간 형식: 
   - rfc3339
  isEventTime: true
- name: view_duration_s
  required: true
  유형: float
```

{% endtab %}
{% endtabs %}

### `test` 제한 사항

* 해당 `test` 명령은 JSON 이벤트만 지원합니다.

## PAT를 통한 스키마 업로드

Panther Analysis Tool(PAT)을 통해 스키마를 업로드하는 방법은 다음을 참조하세요: [Custom Logs: Panther Analysis Tool을 사용한 로그 스키마 업로드](/ko/data-onboarding/custom-log-types.md#uploading-log-schemas-with-the-panther-analysis-tool).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.panther.com/ko/panther/pantherlog.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
