> 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/detections/rules/writing-simple-detections.md).

# 간단한 디택션 작성

## 개요

Simple 디택션은 CLI 워크플로에서 YAML로 생성할 수 있으며, 또한 다음에서 생성할 수도 있습니다 [Simple 디택션 빌더](/ko/detections/rules/simple-detection-builder.md) 콘솔에서.

CLI 워크플로에서 생성되어 이후 Panther에 업로드된 Simple 디택션은 다음에서 보고 편집할 수 있습니다 [Simple 디택션 빌더](/ko/detections/rules/simple-detection-builder.md) 콘솔에서. 팀 구성원들의 YAML 경험 수준이 제각각일 경우 유용할 수 있습니다.

Simple 디택션은 다음에서 사용할 수 있습니다 [디택션 파생](/ko/detections/rules/derived.md).

로컬에서 디택션을 Simple 디택션(YAML)으로 작성할지 Python 디택션으로 작성할지 확실하지 않다면 다음을 참고하세요 [Python 사용 vs. Simple 디택션 YAML](https://docs.panther.com/ko/detections/rules/pages/03a99462193d3cb6f09cb46a6d9fa32a7a6035d0#using-python-vs.-simple-detections-yaml) 섹션.

{% hint style="info" %}
팀에서 CLI 워크플로를 사용해 디택션 콘텐츠를 관리하는 경우, 다음을 사용해 디택션에 적용한 변경 사항은 [Simple 디택션 빌더](/ko/detections/rules/simple-detection-builder.md) 콘솔에서 만든 내용은 다음 업로드 때 덮어써집니다(단 [인라인 필터](#inlinefilters) 콘솔에서 생성된 항목은 유지됩니다).

콘솔의 Simple 디택션 빌더를 사용해 디택션을 생성하거나 편집했다면, 결과로 생성된 YAML 표현을 복사하여 로컬 디택션 파일에 포함하세요. 그래야 다음 업로드 때 변경 사항이 덮어써지는 것을 방지할 수 있습니다.
{% endhint %}

### Simple 디택션 YAML의 한계

* [예약된 룰](/ko/detections/rules.md) 그리고 [정책](/ko/detections/policies.md) Simple 디택션으로는 생성할 수 없습니다.
  * 오직 [룰](/ko/detections/rules.md) YAML에서 생성할 수 있습니다.
* Panther에서 관리하는 Simple 디택션은 아직 사용할 수 없습니다.
  * 그러나 다음을 사용할 수는 있습니다 [Panther에서 관리하는 Python 디택션](/ko/detections/panther-managed.md) 자체 Simple 디택션과 함께.
* 특정 로그 소스용 함수를 포함한 Python에서 사용 가능한 많은 헬퍼 함수는 YAML에 반영되지 않습니다.
  * 일부 [전역 도우미](https://github.com/panther-labs/panther-analysis/tree/master/global_helpers) 는 YAML 키로 변환되었습니다. 예: [`deep_get()` ](/ko/detections/rules/python/globals.md#deep_get)있거나 [`DeepKey`](/ko/detections/rules/writing-simple-detections/match-expression.md#deepkey).
* Simple 디택션에서는 외부 API를 호출할 수 없습니다. Dynamo KV 스토어에서 값을 가져와 다음 용도로 사용하는 것도 포함됩니다 [캐싱](/ko/detections/rules/python/caching.md).

## YAML에서 Simple 디택션(룰)을 만드는 방법

<details>

<summary>CLI 워크플로에서 Simple 디택션 룰 만들기</summary>

Simple 디택션을 로컬에서 작성하는 경우(다음이 아닌 [Simple 디택션 빌더](/ko/detections/rules/simple-detection-builder.md) 콘솔에서), GitHub 또는 GitLab 같은 버전 관리 시스템에서 로컬 디택션 파일을 관리할 것을 권장합니다.

**폴더 설정**

룰을 폴더로 그룹화하는 경우, 각 폴더 이름에는 `룰` 업로드 중에 찾을 수 있도록( PAT 또는 콘솔의 대량 업로더를 사용하는 경우 모두 포함).

로그/리소스 유형별로 룰을 폴더로 그룹화할 것을 권장합니다. 예: `suricata_룰` 또는 `aws_s3_정책`.

**파일 설정**

각 룰과 예약된 룰은 다음으로 구성됩니다:

* YAML 명세 파일(다음이 포함된 파일 `.yml` 확장자)을 포함하며, 디택션 로직과 디택션의 메타데이터 속성을 담고 있습니다.
  * 이 파일은 Python YAML 파일과 비슷한 구문을 가지며, 몇 가지 추가 키가 있습니다.

Simple 디택션 룰에는 다음이라고 불리는 불리언 로직 목록이 포함됩니다 [일치 표현식을 포함하세요](/ko/detections/rules/writing-simple-detections/match-expression.md) 이 로직은 의심스러운 행동을 탐지합니다. 값이 `True` 반환되면 의심스러운 활동을 의미하며, 알러트를 트리거합니다.

자세한 내용은 [Simple 디택션 YAML 구문](#simple-detection-yaml-syntax), 그리고 다음을 확인하세요 [아래의 필수 및 선택 YAML 필드 전체 목록](#simple-detection-rule-specification-reference).

* YAML 파일을 만드세요(예: `my_new_룰.yml`) 아래 템플릿을 사용하여(최상위 `디택션` key 포함):

  ```yaml
  AnalysisType: 룰
  DedupPeriodMinutes: 60 # 1시간
  DisplayName: 명세 형식을 확인하는 예시 룰
  Enabled: true
  RuleID: Type.Behavior.MoreContext
  Severity: High
  LogTypes:
    - LogType.GoesHere
  Reports:
    ReportName(CIS, MITRE ATT&CK 등):
      - 이 룰과 관련된 특정 보고서 섹션
  Tags:
    - Tags
    - Go
    - Here
  Description: >
    이 룰은 Panther CLI의 CLI 워크플로를 검증하기 위해 존재합니다.
  Runbook: >
    먼저 이 명세 형식을 작성한 사람이 누구인지 알아낸 다음, 피드백과 함께 알려주세요.
  Reference: https://www.a-clickable-link-to-more-info.com
  디택션:
    - KeyPath: hostName
      Condition: Contains
      Value: prod
  ```

이 룰을 Panther에 업로드한 후에는 콘솔의 다음 위치에서 볼 수 있습니다 [Simple 디택션 빌더](/ko/detections/rules/simple-detection-builder.md).

</details>

## Simple 디택션 YAML 구문

각 사용자 지정 Simple 디택션은 다음으로 구성될 수 있습니다:

* 디택션 키

  ```yaml
  디택션: 
  ```
* 필터 키

  ```yaml
  InlineFilters: 
  ```
* 메타데이터 키

  ```yaml
  AnalysisType: 
  Enabled: 
  CreateAlert: 
  RuleID:
  CreatedBy:
  LogTypes: 
  Reports: 
  Tags: 
  Tests: 
  ```
* 알러트 키(동적)

  ```yaml
  동적 심각도: 
  AlertTitle: 
  알러트컨텍스트: 
  그룹화 기준: 
  ```
* 알러트 키(정적)

  ```yaml
  Severity:
  Description:
  DedupPeriodMinutes:
  Threshold: 
  DisplayName:
  OutputIds:
  참조:
  Runbook:
  SummaryAttributes: 
  ```

이들 각 키에 대해, 필수 및 선택 항목이 무엇인지 포함하여 자세히 알아보려면 다음을 참고하세요 [아래의 Simple 디택션 룰 명세 참조](#simple-detection-rule-specification-reference).

### `디택션`

다음 안에서 `디택션` 키에는 하나 이상의 [일치 표현식을 포함하세요](/ko/detections/rules/writing-simple-detections/match-expression.md).

### `InlineFilters`

사용 방법 자세히 알아보기 `InlineFilters` Simple 디택션에서 다음 항목은 [인라인 필터로 디택션 수정하기](/ko/detections/rules/inline-filters.md#creating-filters-in-the-cli-workflow).

### Simple 디택션의 동적 알러트 키

알러트 필드는 해당 디택션에서 생성된 알러트에 적용되는 Simple 디택션 정의의 필드입니다.

알러트 필드는 정적이거나 동적일 수 있습니다. 정적 알러트 필드에서는 디택션 정의에 고정 값을 제공하며, 이는 들어오는 이벤트에 따라 달라지지 않습니다. 그러나 동적 알러트 필드는 이벤트의 정보를 사용하여 값을 결정할 수 있습니다.

다음을 사용하는 경우 [알러트 중복 제거](/ko/detections/rules.md#deduplication-of-alerts), 다음 *첫 번째* 디택션과 일치하는 첫 번째 이벤트가 이 알러트 키에 사용됩니다.

#### `DynamicSeverities`

사용합니다 `DynamicSeverities` 이 디택션과의 일치로 생성된 알러트의 심각도를 동적으로 설정합니다. 이 필드는 이벤트의 값을 사용해 심각도를 결정할 수 있으므로 동적입니다.

있을 때 `DynamicSeverities` 존재하면 해당 값이 다음의 값을 덮어씁니다. `심각도` 키. `심각도` 는 여전히 필요하며, 다음 항목들 중 어느 것과도 일치하지 않으면 해당 값이 대체값이 됩니다. [일치 표현식을 포함하세요](/ko/detections/rules/writing-simple-detections/match-expression.md) 내에 포함된 `DynamicSeverities`.

다음 안에서 `DynamicSeverities` 키에는 하나 이상의 `ChangeTo` 키에는 각각 대응하는 `조건` 키가 있습니다. 의 값은 `ChangeTo` 다음 중 하나여야 합니다 [알러트 심각도](/ko/detections/rules.md#alert-severity). 다음은 `ChangeTo` 블록은 위에서 아래 순으로 평가되며, 일치 항목이 발견되면 평가가 중지됩니다.

내부에서 `조건`, 하나 이상의 [일치 표현식을 포함하세요](/ko/detections/rules/writing-simple-detections/match-expression.md). 다음은 `조건` 목록에는 다음과 같은 제한이 있습니다:

* 아니요 [리스트 컴프리헨션](/ko/detections/rules/writing-simple-detections/match-expression.md#list-comprehension-match-expressions), [다중 키](/ko/detections/rules/writing-simple-detections/match-expression.md#multi-key-match-expressions), 또는 [절대](/ko/detections/rules/writing-simple-detections/match-expression.md#absolute-match-expressions) 일치 표현식을 사용할 수 있습니다.
* 아니요 [ 결합자](/ko/detections/rules/writing-simple-detections/match-expression.md#combinators) 사용할 수 있습니다.

예:

```yaml
동적 심각도:
  - 변경 대상: CRITICAL
    조건:
      - Key: status
        Condition: Equals
        Value: severe
  - ChangeTo: MEDIUM
    조건:
      - KeyPath: user.name
        Condition: StartsWith
        Value: admin_
      - DeepKey:
          - user
          - roles
        Condition: Contains
        Value: wheel
```

#### `알러트Title`

사용합니다 `알러트Title` 이 디택션과의 일치로 생성된 알러트의 제목을 동적으로 설정합니다. 이 필드는 제목에 이벤트 값을 사용할 수 있으므로 동적입니다.

다음의 값은 `알러트Title` 문자열이어야 합니다. 중괄호를 사용하여 이벤트 값을 참조할 수 있습니다. 중괄호 안에서는 JSON 경로 구문을 사용하세요.

예:

```yaml
AlertTitle: "User {actor.username}가 {time}에 {target.username}을 사칭했습니다"
```

#### `알러트Context`

`알러트Context` 생성된 알러트에 전달할 이벤트 데이터를 사전 형식으로 식별할 수 있습니다.

내부에서 `알러트Context`, 하나 이상의 `KeyName` 그리고 `KeyValue` 쌍. `KeyName` 원하는 문자열을 사용하며, 이는 알러트 컨텍스트 사전의 키가 됩니다. 내부에서는 `KeyValue`, 다음을 사용하세요 [키 지정자](/ko/detections/rules/writing-simple-detections/match-expression.md#key-specifiers) 이벤트 키를 나타내며, 그 값은 알러트 컨텍스트 사전의 값이 됩니다.

`KeyValue` 값은 JSON 호환이어야 합니다. 호환되지 않는 값의 예로는 Python의 `nan`, `inf`, 그리고 `-inf`.

예:

```yaml
알러트컨텍스트:
  - KeyName: ip
    KeyValue:
      - Key: sourceIP
  - KeyName: user
    KeyValue:
      DeepKey:
        - user
        - 사용자명
  - KeyName: resource
    KeyValue:
      KeyPath: resource.arns
```

#### `GroupBy`

`GroupBy` 디택션의 중복 제거 문자열을 설정합니다. 중복 제거 문자열이 설정되는 우선순위 순서를 포함해 중복 제거에 대해 자세히 알아보려면 다음을 참고하세요 [룰 및 예약된 룰](/ko/detections/rules.md#deduplication-of-alerts).

다음 안에서 `GroupBy` 키에는 다음으로 정의된 하나 이상의 이벤트 키 목록을 포함하세요 [키 지정자](/ko/detections/rules/writing-simple-detections/match-expression.md#key-specifiers).

예:

```yaml
그룹화 기준:
  - Key: sourceIP
  - KeyPath: user.name
  - KeyPath: resource.arn
```

다음 아래에 제공된 키의 값은 `GroupBy` 콜론으로 결합되어 중복 제거 문자열을 형성합니다. 위 예제의 출력된 중복 제거 문자열은 다음과 같습니다:

```
<sourceIP의 값>:<user.name의 값>:<resource.arn의 값>
```

## Simple 디택션 룰 명세 참조

아래 표에는 Simple 디택션에 사용할 수 있는 모든 YAML 키가 포함되어 있습니다. 필수 필드는 **굵게**.

Python 룰을 작성 중이라면 대신 다음을 참고하세요 [Python 룰 명세 참조](/ko/detections/rules/python.md#python-rule-specification-reference).


---

# 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/detections/rules/writing-simple-detections.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.
