> 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`, Custom Logs와 함께 작동하는 CLI 도구입니다. 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`.

### 스키마 출력

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

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

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

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

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

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

pantherlog를 사용하여 다음의 샘플 파일들로부터 스키마 파일을 생성할 수 있습니다: [줄바꿈 구분 JSON](https://jsonlines.org/) 형식입니다. 이 도구는 제공된 로그를 스캔하고 추론된 스키마를 `stdout`.

예를 들어, 로그의 스키마를 추론하려면 `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의 Timestamps 섹션](/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`: 스키마 검증

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

예를 들어, 다음의 로그를 구문 분석하려면 `sample_logs.jsonl` 에서의 로그 스키마를 사용하여 `schema.yml`, 다음을 사용하세요:

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

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

```
$ 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` 이벤트에는 다음이 모두 포함되어야 합니다: [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 지식 베이스의 다음 문서를 참조하세요: [스키마에 대해 여러 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
fields:
- 이름: action
  required: true
  type: string
- name: controller
  required: true
  type: string
- name: correlation_id
  required: true
  type: string
- name: cpu_s
  required: true
  type: float
- name: db_duration_s
  required: true
  type: bigint
- name: duration_s
  required: true
  type: float
- name: format
  required: true
  type: string
- 이름: method
  required: true
  type: string
- name: path
  required: true
  type: string
- name: remote_ip
  required: true
  type: string
  표시자:
   - ip
- 이름: status
  required: true
  type: bigint
- name: tag
  required: false
  type: string
- 이름: time
  required: true
  type: timestamp
  timeFormats: 
   - rfc3339
  isEventTime: true
- name: view_duration_s
  required: true
  type: 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:

```
GET https://docs.panther.com/ko/panther/pantherlog.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.
