# PantherFlow(베타)

## 개요

{% hint style="info" %}
PantherFlow는 Panther 버전 1.110부터 오픈 베타 상태이며 모든 고객이 사용할 수 있습니다. 버그 리포트와 기능 요청은 Panther 지원팀에 공유해 주세요.
{% endhint %}

PantherFlow는 Panther의 파이프라인화된 쿼리 언어입니다. 이해하기 쉽게 설계되었지만 강력하고 표현력이 있습니다.

Panther에서 데이터를 탐색하고 분석하려면 PantherFlow를 사용하세요. 그 [연산자](https://docs.panther.com/ko/pantherflow/operators) 와 [함수](https://docs.panther.com/ko/pantherflow/functions)을(를) 사용하면 필터링, 변환, 집계와 같은 다양한 데이터 작업을 수행할 수 있으며, 추가로 [결과를 시각화할 수 있습니다](https://docs.panther.com/ko/pantherflow/operators/visualize) 막대 또는 선 차트로. PantherFlow는 스키마에 유연하므로(스키마가 다른 소스 포함) 단일 쿼리에서 여러 데이터 소스를 원활하게 검색할 수 있습니다.

{% hint style="info" %}
자체 PantherFlow 쿼리를 작성하는 것 외에도, [검색에서 자연어로 PantherFlow를 생성하기 위해 AI를 사용할 수 있습니다](https://docs.panther.com/ko/search/search-tool) Search에서.
{% endhint %}

PantherFlow 쿼리는 파이프(|)를 사용하여 데이터 작업을 구분하며, 이러한 작업은 순차적으로 처리됩니다.`|`즉, 쿼리의 첫 번째 연산자의 출력이 두 번째 연산자의 입력으로 전달되고 그 다음으로 계속됩니다. 아래 예제 쿼리를 보세요:

```kusto
okta_systemlog
| where p_event_time > time.ago(1d)
| search 'doug'
| summarize agg.count() by eventType 
```

PantherFlow 쿼리를 최적화하는 방법은 [PantherFlow 모범 사례](https://docs.panther.com/ko/pantherflow/best-practices).

### PantherFlow를 사용할 위치

Search에서 데이터를 쿼리하려면 PantherFlow를 사용하세요. [여기에서 Search에 PantherFlow를 입력하는 방법을 알아보세요](https://docs.panther.com/ko/search/search-tool#using-pantherflow-in-search)뿐만 아니라, [여기에서 자연어로 PantherFlow를 생성하기 위해 AI를 사용하는 방법을 알아보세요](https://docs.panther.com/ko/search/search-tool#ai-powered-pantherflow-query-generation).

쿼리 작성을 돕기 위해 Search의 PantherFlow 코드 편집기는 자동완성, 오류 밑줄, 호버 툴팁, 인레이 힌트 및 함수 시그니처 도움말을 제공합니다.

## PantherFlow 쿼리가 작동하는 방식

"PantherFlow 쿼리"라는 용어는 일반적으로 [테이블 식 표현문](https://docs.panther.com/ko/statements#tabular-expression-statements)을(를) 가리키며, 이는 데이터셋을 검색하여 어떤 형태로 반환합니다(대조적으로 [let 문](https://docs.panther.com/ko/statements#let-statements)). 테이블 식 표현문에는 보통 [연산자](https://docs.panther.com/ko/pantherflow/operators) 파이프(|)로 구분된`|`각 연산자는 데이터에 대해 어떤 작업(예: 필터링 또는 변환)을 수행한 다음 다음 연산자로 전달합니다. 연산자 순서는 중요하며 PantherFlow 문은 순차적으로 읽힙니다.

PantherFlow 구문 개요는 [PantherFlow 빠른 참조](https://docs.panther.com/ko/pantherflow/quick-reference)에서 확인하거나 구문 주제를 더 자세히 살펴보세요:

* [PantherFlow 문들](https://docs.panther.com/ko/pantherflow/statements)
* [PantherFlow 연산자들](https://docs.panther.com/ko/pantherflow/operators)
* [PantherFlow 데이터 유형들](https://docs.panther.com/ko/pantherflow/data-types)
* [PantherFlow 표현식들](https://docs.panther.com/ko/pantherflow/expressions)
* [)을 가진 결과 집합을 생성한 다음](https://docs.panther.com/ko/pantherflow/functions)

### 단계별 PantherFlow 쿼리 예제

다음 PantherFlow 쿼리를 살펴보겠습니다:

```kusto
panther_logs.public.aws_alb
| where p_event_time > time.ago(1d)
| sort p_event_time
| sort events desc
```

요약하면, 이 쿼리는 `aws_alb` 테이블에서 데이터를 읽고, 지난 하루 이전에 발생한 이벤트를 필터링하고, 남은 이벤트를 시간순으로 정렬한 다음 첫 번째 10개 이벤트를 반환합니다.

각 줄을 더 자세히 살펴보겠습니다:

1. `panther_logs.public.aws_alb`
   * 이 문장은 데이터 소스를 식별합니다.
   * 이 쿼리는 `panther_logs.public.aws_alb` 테이블에서 읽고 있습니다. 쿼리에 이 줄만 포함되어 있다면 테이블의 모든 데이터가 반환될 것입니다.
2. `| where p_event_time > time.ago(1d)`
   * 사용자를 사용할 것이며, [`where` PantherFlow에서 모든 로그를 검색하려면](https://docs.panther.com/ko/pantherflow/operators/where) 는 [표현식](https://docs.panther.com/ko/pantherflow/expressions) 을(를) 사용하여 데이터를 필터링합니다.
   * 이 쿼리는 `p_event_time` 필드 값이 하루 전 시간보다 큰 데이터를 요청하고 있습니다. 다시 말해, 지난 하루 이내에 발생한 이벤트를 요청하는 것입니다. `time.ago()` 함수는 현재 시간에서 빼기 연산을 수행하며, 그 인수(`1d`)는 하루를 나타내는 타임스탬프 상수입니다.
3. `| sort p_event_time`
   * 사용자를 사용할 것이며, [`sort` PantherFlow에서 모든 로그를 검색하려면](https://docs.panther.com/ko/pantherflow/operators/sort) 는 하나 이상의 필드 값으로 이벤트를 정렬할 수 있게 해줍니다.
   * 이 쿼리는 데이터를 `p_event_time`로 정렬합니다. 이유는 [기본 정렬 순서](https://docs.panther.com/ko/pantherflow/operators/sort) 가 내림차순이므로 가장 최근 이벤트가 먼저 반환됩니다.
4. `| sort events desc`
   * 사용자를 사용할 것이며, [`limit` PantherFlow에서 모든 로그를 검색하려면](https://docs.panther.com/ko/pantherflow/operators/limit) 는 반환할 이벤트 수의 최대값을 정의합니다.
   * 이 쿼리는 최대 10개의 이벤트를 요청하고 있습니다.

추가 쿼리 예제 보기:

* [PantherFlow 예제 쿼리들](https://docs.panther.com/ko/pantherflow/example-queries)
* [예약 검색 예제들](https://docs.panther.com/ko/search/scheduled-searches/examples)

## PantherFlow의 제한 사항

* 다음과 같은 작업은 할 수 있지만, [저장된 검색 만들기](https://docs.panther.com/ko/search/search-tool#creating-a-saved-search) Panther 콘솔에서 PantherFlow를 사용하여, 다음은 불가능합니다:
  * 저장된 검색 예약(즉, [를 반환하면 다른 선택적 함수들이 실행되고 알러트가](https://docs.panther.com/ko/search/scheduled-searches))
  * 개발자 워크플로우에서 PantherFlow를 사용하여 저장된 검색 만들기(즉, `saved_query` 을(를) 업로드하거나, [프로그램 방식으로 업로드할 수 있습니다](https://docs.panther.com/ko/panther/detections-repo/pat/pat-commands) 또는 [REST](https://docs.panther.com/ko/panther/api/rest/queries) 이전에 생성한 Snowflake 사용자 이름, 예를 들면 [GraphQL](https://docs.panther.com/ko/panther/api/graphql/data-lake-queries) API를 사용하여)
* 집계(예: [`summarize` PantherFlow에서 모든 로그를 검색하려면](https://docs.panther.com/ko/pantherflow/operators/summarize))는 [검색 결과 히스토그램](https://docs.panther.com/ko/search/search-tool#search-results-histogram).
* 에 대한 정보를 표시하지 않습니다. [**Search에서** 목록](https://docs.panther.com/ko/search/search-tool#adding-removing-and-reordering-fields-in-the-results-table) 사용 가능한 필드 [`project`](https://docs.panther.com/ko/pantherflow/operators/project), [`extend`](https://docs.panther.com/ko/pantherflow/operators/extend)및 [`summarize`](https://docs.panther.com/ko/pantherflow/operators/summarize).
* 는
* 사용자를 사용할 것이며, [`visualize` 연산자마다 자체적인 제한 사항이 있습니다.](https://docs.panther.com/ko/operators/visualize#limitations).
