# 데이터 탐색기 SQL 검색 예제

## 개요

이 예시는 Panther Console에서 Data Explorer를 사용하여 Security Data Lake 내의 데이터를 이용해 조사하고 질문에 답하는 방법을 보여줍니다.

Snowflake 환경에서 구문과 문장의 올바른 사용법에 대한 예시는 다음을 참조하세요. [Snowflake 문서: SQL 명령 참조](https://docs.snowflake.com/en/sql-reference-commands.html) 및 [반구조화된 데이터 쿼리하기.](https://docs.snowflake.com/en/user-guide/querying-semistructured.html)

이 페이지의 예시는 모든 로그 유형에 적용되며, 하위 페이지에는 특정 로그 유형에 적용되는 예시가 포함되어 있습니다:

* [VPC Flow 로그](/ko/search/data-explorer/example-queries/vpc-flow-logs-queries.md)
* [CloudTrail 로그](/ko/search/data-explorer/example-queries/cloudtrail-logs-queries.md)
* [GuardDuty 로그](/ko/search/data-explorer/example-queries/guardduty-logs-queries.md)
* [S3 Access 로그](/ko/search/data-explorer/example-queries/s3-access-logs-queries.md)
* [NGINX 및 ALB Access 로그](/ko/search/data-explorer/example-queries/nginx-and-alb-access-logs-queries.md)
* [GitHub Audit 로그](/ko/search/data-explorer/example-queries/github-audit-logs-queries.md)

### 고려 사항

모든 쿼리는 결과 크기를 제어해야 합니다. 이는 다음을 사용하여 수행할 수 있습니다. `LIMIT` 또는 `GROUP BY` 절.

## 이 IP 주소가 내 네트워크에서 활동한 적이 있습니까(그리고 어떤 로그에 있습니까)?

이는 조사에서 종종 가장 먼저 묻는 질문 중 하나입니다. IP 주소와 같은 알려진 악성 지표가 있다면, 네트워크/시스템에서 관련 활동이 있는지 확인한 뒤 상세 조사가 필요합니다.

Snowflake의 `포함` 메서드는 데이터와 부분 일치를 할 수 있으며, Snowflake의 `array_contains` 메서드는 해당 데이터에 대해 정확한 일치를 요구합니다.

아래 예시에서는 Panther 필드 `p_any_ip_addresses` 가 사용됩니다. Panther는 모든 데이터 소스에서 여러 일반적인 지표 필드를 표준 필드로 추출합니다(참조 [Panther 필드](/ko/search/panther-fields.md)).

```sql
SELECT
 p_log_type, count(1) AS row_count
FROM panther_views.public.all_logs
WHERE p_occurs_between('2021-01-01', '2021-01-02')
     AND array_contains('95.123.145.92'::variant, p_any_ip_addresses)
GROUP BY p_log_type
LIMIT 100
```

## 모든 로그에서 행 수 기준 상위 10개 IP는 무엇입니까?

활동을 순위화하는 것(상위 또는 하위)은 네트워크 가시성을 확보하는 데 유용한 기법입니다. 상위 순위의 활동은 DDOS 공격에 연루된 IP 주소를 찾는 데 도움이 될 수 있으며, 하위 순위(ORDER BY를 ASC로 변경)는 은밀한 활동을 드러낼 수 있습니다.

```sql
SELECT
  ip.value as ip,
  count(1) as total_rows
FROM panther_views.public.all_logs, LATERAL FLATTEN(input => p_any_ip_addresses) ip
WHERE p_occurs_between('2021-01-01', '2021-01-02')
GROUP BY ip.value
ORDER BY  total_rows DESC
LIMIT 100
```

## 모든 로그에서 로그 유형별 상위 10개 IP는 무엇입니까?

이는 위 쿼리의 변형으로, IP가 활동을 보이는 데이터 소스의 수에 따라 IP를 순위화합니다. 이는 해당 IP 주소가 전체 시스템에서 가지는 "도달 범위"의 정도를 보여줍니다.

```sql
SELECT
  ip,
  count(distinct p_log_type) as datasets
FROM
(
SELECT
  p_log_type,
  ip. value as ip
FROM panther_views.public.all_logs, LATERAL FLATTEN(input => p_any_ip_addresses) ip
WHERE p_occurs_between('2021-01-01', '2021-01-02')
GROUP BY ip.value, p_log_type
)
GROUP BY ip
ORDER BY  datasets DESC
LIMIT 100
```


---

# 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/search/data-explorer/example-queries.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.
