# PantherFlow 모범 사례

## 개요

{% hint style="info" %}
PantherFlow는 Panther 버전 1.110부터 공개 베타로 제공되며, 모든 고객이 이용할 수 있습니다. 버그 보고 및 기능 요청은 Panther 지원 팀에 공유해 주세요.
{% endhint %}

PantherFlow 쿼리 결과가 가능한 한 빨리 반환되도록 하고(검색으로 인해 발생하는 Snowflake 비용을 최소화하기 위해), 아래의 모범 사례를 따르는 것이 권장됩니다.

이를 적용한 후에도 쿼리 실행이 여전히 느리다면:

* 쿼리의 시간 범위를 줄이세요.
* 쿼리가 완료되면 반환된 행 수를 확인하여 얼마나 많은 데이터를 쿼리하는지 파악하세요. 데이터 양이 많다면 시간이 걸리는 것이 예상될 수 있습니다.
* 추가 도움이 필요하면 Panther 지원 팀에 문의하세요.

## PantherFlow 일반 모범 사례

### **다음을 사용하세요: `limit` 연산자**

다음을 사용하세요: [`limit` 연산자](/ko/pantherflow/operators/limit.md) 를 사용하여 쿼리가 반환할 최대 레코드 수를 지정하세요.

예시: `panther_logs.public.aws_alb | limit 100`

### **시간 범위 필터 사용**

다음을 사용하세요: [`where` 연산자](/ko/pantherflow/operators/where.md) 를 사용하여 시간 범위로 필터링하세요(아마도 `p_event_time`을 대상으로). 시간 범위 필터가 있는 쿼리는 더 적은 수의 [마이크로 파티션](https://docs.snowflake.com/en/user-guide/tables-clustering-micropartitions)에 액세스하므로 결과를 더 빠르게 반환합니다.

예시: `panther_logs.public.aws_alb | where p_event_time > time.ago(1d)`

에 대해 자세히 알아보기 [여기에서 사용할 수 있는 시간 함수](/ko/pantherflow/functions.md#date-time).

### **다음을 사용하여 `p_any` 필드**

로그 수집 중 Panther는 일반적인 보안 지표를 `p_any` 필드로 추출하여 모든 데이터 소스에서 속성 이름을 표준화합니다. 이 `p_any` 필드는 최적화된 열에 저장됩니다. 여러 로그 유형에 대해 서로 다른 이름의 필드 대신 `p_any` 필드를 쿼리하는 것이 권장됩니다.

다음에서 자세히 알아보기 [표준 필드](https://docs.panther.com/search/panther-fields).

예시: `panther_logs.public.aws_alb | '10.0.0.0' in p_any_ip_addresses`

### **다음을 사용하세요: `project` 연산자**

다음이 없는 쿼리는 [`project` 연산자](/ko/pantherflow/operators/project.md) 모든 열을 가져오므로 쿼리가 느려질 수 있습니다. 가능한 경우 `project` 를 사용해 조사에 필요한 필드만 쿼리하세요.

예시: `panther_logs.public.aws_alb | project targetIp, targetPort`

### **결과 요약**

요약은 전체 로그 레코드를 가져오는 쿼리보다 더 빠르게 실행됩니다. 요약을 사용하는 것은 긴 기간의 로그를 조사할 때, 또는 조사 중인 시간 범위에 데이터 볼륨이 얼마나 있는지 모를 때 특히 유용합니다.

전체 데이터 세트를 쿼리하는 대신 [`summarize` 연산자](/ko/pantherflow/operators/summarize.md)를 사용하세요. 더 빠르게 실행되며 다음에 쿼리할 더 좁은 시간 범위를 결정하는 데 도움이 됩니다.

예시: `panther_logs.public.aws_alb | summarize count=agg.count() by targetIp`

에 대해 자세히 알아보기 [여기에서 사용할 수 있는 집계 함수](/ko/pantherflow/functions.md#aggregations).

### **다음으로 데이터를 일찍 필터링하세요. `where`**

다음이 있는 [`where`](/ko/pantherflow/operators/where.md) 절을 사용해 다음과 같은 비용이 큰 작업을 수행하기 전에 [`summarize`](/ko/pantherflow/operators/summarize.md) 또는 [`조인`](/ko/pantherflow/operators/join.md)나중이 아니라 먼저 필터링하세요.

예시:

```kusto
// 대신:
panther_logs.public.aws_alb 
| summarize agg.count() by actor 
| where actor != nil

// 이렇게 사용:
panther_logs.public.aws_alb 
| where actor != nil 
| summarize agg.count() by actor 
```

### **다음을 피하세요: `search` 연산자**

the [`search` 연산자](/ko/pantherflow/operators/search.md) 는 속도를 저하시킬 수 있으므로 꼭 필요한 경우가 아니면 피해야 합니다. 검색하려는 텍스트가 포함될 수 있는 열이 어떤 것인지 알고 있다면, 지정된 데이터베이스/테이블의 *모든* 열을 대상으로 `search`검색하는 대신 [`where`](/ko/pantherflow/operators/where.md) 다음과 함께 [`strings.contains()`](https://docs.panther.com/ko/pantherflow/pages/e5c4ab662f13148d5d148a22c398090241e61a1c#strings.contains).

예시:

* 다음 대신: `| search 'alice'`
* 다음 사용: `| where strings.contains(name, 'alice')`

## PantherFlow에서 모든 로그를 가장 잘 검색하는 방법

PantherFlow에서 모든 로그를 검색하려면 [`union` 연산자](/ko/pantherflow/operators/union.md):

```kusto
union panther_logs.public.*
```

{% hint style="info" %}
에 대한 추가 최적화는 `union` 예정되어 있습니다.
{% endhint %}

검색하려는 값이 어떤 열에 나타나야 하는지 알고 있다면(예: 지표 검색—다음에서 침해 지표\[IoC]를 검색하는 경우 [`p_any` 필드](/ko/search/panther-fields.md#indicator-fields)), `union panther_logs.public.*` 에 필터를 추가하여 [`project`](/ko/pantherflow/operators/project.md) Run Panther AI [`where`](/ko/pantherflow/operators/where.md) 관련 열에서만 IoC를 검색하도록 검색을 최적화할 수 있습니다:

```kusto
union panther_logs.public.*
| project p_event_time, p_any_ip_addresses
| where p_event_time > time.ago(1d)
| where p_any_ip_addresses != null
| where 'ip1' in p_any_ip_addresses or 'ip2' in p_any_ip_addresses
```

Panther에서 다음을 사용해 지표 검색을 수행할 수도 있습니다:

* (권장) [검색](/ko/search/search-tool.md) 도구: 다음 참조 [침해 지표 검색](/ko/search/search-tool.md#searching-indicators-of-compromise)
  * Search에는 모든 로그를 효율적으로 검색할 수 있게 해주는 기본 제공 최적화가 있습니다.
* the `executeIndicatorSearchQuery` [GraphQL API](/ko/panther/api/graphql.md) 엔드포인트: 예시 보기 [여기](/ko/panther/api/graphql/data-lake-queries.md#execute-a-search-query)
* [Panther AI](/ko/ai.md): 올바른 [데이터 검색 및 분석 도구](/ko/ai.md#data-search-and-analysis) 가 자동으로 선택됩니다

{% hint style="warning" %}
다음을 사용하여 모든 로그를 쿼리하지 마세요. `panther_views` 데이터베이스—이는 [폐기 예정입니다](https://docs.panther.com/search/backend#panther-views).
{% endhint %}


---

# Agent Instructions: 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/pantherflow/best-practices.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.
