> 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 디택션은 YAML로 된 CLI 워크플로에서 만들 수 있으며, 또한 다음에서 만들 수도 있습니다 [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).
* 외부 API 호출은 Simple 디택션에서 할 수 없습니다. 여기에는 캐싱에 사용하기 위해 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_rules` 또는 `aws_s3_policies`.

**파일 설정**

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

* YAML 사양 파일(다음과 같은 파일 `.yml`  확장자)을 포함하며, 디택션 로직과 디택션의 메타데이터 속성도 포함합니다.
  * 이 파일은 몇 가지 추가 키를 제외하면 Python YAML 파일과 비슷한 구문을 가집니다.

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

자세히 알아보기 [간단한 디택션 YAML 구문](#simple-detection-yaml-syntax), 그리고 다음의 [아래의 필수 및 선택 YAML 필드 전체 목록](#simple-detection-rule-specification-reference).

* YAML 파일을 생성하세요(예: `my_new_룰.yml`) 아래 템플릿을 사용하여(최상위 수준의 `디택션` 키):

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

이 룰이 Panther에 업로드되면, Console의 [Simple 디택션 빌더](/ko/detections/rules/simple-detection-builder.md).

</details>

## 간단한 디택션 YAML 구문

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

* 디택션 키

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

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

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

  ```yaml
  DynamicSeverities: 
  AlertTitle: 
  AlertContext: 
  GroupBy: 
  ```
* 알러트 키(정적)

  ```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` 키이며, 각각에 대응하는 `Conditions` 키입니다. 값은 `ChangeTo` 다음 중 하나여야 합니다. [알러트 심각도](/ko/detections/rules.md#alert-severity). 다음은 `ChangeTo` 블록은 위에서 아래 순서로 평가되며, 일치 항목이 발견되면 평가가 중지됩니다.

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

* 아니요 [리스트 컴프리헨션](/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
DynamicSeverities:
  - ChangeTo: CRITICAL
    조건:
      - 키: status
        조건: 같음
        값: severe
  - ChangeTo: MEDIUM
    조건:
      - 키 경로: user.name
        조건: 시작 문자열 일치
        값: admin_
      - DeepKey:
          - user
          - roles
        Condition: Contains
        값: wheel
```

#### `AlertTitle`

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

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

예:

```yaml
AlertTitle: "사용자 {actor.username}가 {time}에 {target.username}를 가장했습니다"
```

#### `알러트Context`

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

다음 항목에서 `알러트Context`, 하나 이상 포함하세요 `키 이름` 및 `키 값` 쌍. `키 이름` 원하는 문자열을 입력하면 알러트 컨텍스트 딕셔너리의 키가 됩니다. 그 안에서 `키 값`, a를 사용하세요 [키 지정자](/ko/detections/rules/writing-simple-detections/match-expression.md#key-specifiers) 이벤트 키를 나타내는 데 사용됩니다—그 값은 알러트 컨텍스트 사전의 값이 됩니다.

`키 값` 값은 JSON을 준수해야 합니다. JSON을 준수하지 않는 값의 예로는 Python의 `nan`, `inf`, 그리고 `-inf`.

예:

```yaml
AlertContext:
  - KeyName: ip
    KeyValue:
      Key: sourceIP
  - KeyName: user
    KeyValue:
      DeepKey:
        - user
        - username
  - 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
GroupBy:
  - Key: sourceIP
  - 키 경로: 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.
