# 로그 소스 관리

## 개요

Panther API는 다음 로그 소스 작업을 지원합니다:

* 로그 소스 통합 목록 조회
* 특정 로그 소스 통합의 세부 정보 가져오기
* 로그 소스 통합 삭제
* (S3 소스에만 해당) 새 로그 소스 통합 생성
* (S3 소스에만 해당) 기존 로그 소스 통합 업데이트

{% hint style="info" %}
the `ListSources`, `GetSource`및 `DeleteSource` 작업은 Panther의 모든 로그 소스에서 지원됩니다. 생성 및 업데이트 작업(`CreateS3LogSource` Run Panther AI `UpdateS3LogSource`)은 현재 S3 로그 소스로만 제한됩니다.
{% endhint %}

콘솔의 API Playground 또는 GraphQL-over-HTTP API를 사용하여 Panther의 API를 호출할 수 있습니다. 이러한 방법에 대해 자세히 알아보려면 다음을 참조하세요. [Panther API](/ko/panther/api.md#step-1-choose-a-method-for-invoking-the-api).

### 필수 API 토큰 권한

API 호출을 시작하기 전에 API 토큰에 필요한 권한이 연결되어 있는지 확인하세요:

* **로그 소스 보기**: 모든 로그 소스 관리 작업에 필요합니다.
* **로그 소스 관리**: mutation인 로그 소스 관리 작업에 필요합니다(즉, `CreateS3LogSource`, `UpdateS3LogSource`및 `DeleteSource`).
* **사용자 정보 읽기**: 다음과 같이 액터와 관련된 통합 필드를 가져오려는 경우 필요합니다. `createdBy`.

<figure><img src="/files/621cd4884c1e8666be155281f12bbab8013c0ede" alt="An &#x22;Integrations&#x22; header is above four checkboxes: View Cloud Security Sources, Manage Cloud Security Sources, View Log Sources, and Manage Log Sources." width="563"><figcaption></figcaption></figure>

## 일반적인 로그 소스 작업

아래는 Panther에서 가장 일반적인 GraphQL 로그 소스 작업들입니다. 이 예제들은 Panther의 GraphQL API를 호출하기 위해 GraphQL 클라이언트(또는 `curl`)를 사용하여 전송해야 하는 문서를 보여줍니다.

#### 로그 소스 목록 조회

{% hint style="info" %}
현재는 다음에서 페이지 매김이 지원되지 않습니다. `sources`—모든 로그 소스가 결과의 첫 번째 페이지에 반환됩니다. 아래 `cursor` 필드가 있는 `input` 객체는, 추후 페이지 매김이 지원될 때를 위한 자리표시자입니다.
{% endhint %}

```graphql
query ListSources {
  sources(input: { cursor: "" }) {
    edges {
      node {
        createdAtTime
        createdBy {
          ... on User {
            id
          }
          ... on APIToken {
            id
          }
        }
        integrationId
        integrationLabel
        integrationType
        isEditable
        isHealthy
        lastEventProcessedAtTime
        lastEventReceivedAtTime
        lastModified
        logTypes
      }
    }
    pageInfo {
      endCursor
      hasNextPage
      hasPreviousPage
      startCursor
    }
  }
}
```

#### 로그 소스 가져오기

다음의 입력은 `source` 가져오려는 로그 소스의 ID입니다.

```graphql
query GetSource {
  source(id: "bcd45662-bab7-4f99-b69f-083a0212568d") {
    createdAtTime
    createdBy {
      ... on User {
        id
      }
      ... on APIToken {
        id
      }
    }
    integrationId
    integrationLabel
    integrationType
    isEditable
    isHealthy
    lastEventProcessedAtTime
    lastEventReceivedAtTime
    lastModified
    logTypes
  }
}
```

#### 로그 소스 삭제

다음의 입력은 `deleteSource` 는 삭제하려는 로그 소스의 ID입니다.

```graphql
mutation DeleteSource {
  deleteSource(input: { id: "bcd45662-bab7-4f99-b69f-083a0212568d" }) {
    id
  }
}
```

#### S3 로그 소스 생성

{% hint style="info" %}
S3 로그 소스를 생성하는 것도 가능합니다 [Terraform을 사용하여](/ko/panther/terraform/s3.md), 또는 [Panther Console에서 수동으로](/ko/data-onboarding/data-transports/aws/s3.md).
{% endhint %}

{% hint style="warning" %}
Panther에서 처음 생성하는 로그 소스는 반드시 Panther Console에서 수행해야 합니다. API를 사용하여 첫 번째 Panther 로그 소스를 설정하면, 다음에 자세히 설명된 "보류 중인 확인" 문제가 발생할 수 있습니다. [이 지식 베이스 문서](https://help.panther.com/articles/2327494518-why-is-my-sns-topic-stuck-in-a-pending-confirmation-state-for-the-sqs-confirmation-for-panther).
{% endhint %}

아래 예시 요청에서 `input` 는 S3 로그 소스를 완전히 나타내는 객체입니다. 표시된 모든 필드는 필수입니다.

의 값 `logProcessingRole` 는 IAM 역할의 ARN입니다. 이 역할을 생성할 때는 다음 사항에 유의하세요. [이 지침](/ko/data-onboarding/data-transports/aws/s3.md#i-want-to-set-everything-up-on-my-own), 어떤 정책이 연결되어야 하는지 설명합니다.

```graphql
mutation CreateS3LogSource {
  createS3Source(
    input: {
      awsAccountId: "0123456789012"
      label: "My Log Source"
      logProcessingRole: "arn:aws:iam::0123456789012:role/PantherLogProcessingRole-somerole"
      logStreamType: JSON
      managedBucketNotifications: false
      s3Bucket: "name-of-my-bucket"
      s3PrefixLogTypes: [
        { excludedPrefixes: [], logTypes: ["AWS.ALB"], prefix: "" }
      ]
    }
  ) {
    logSource {
      createdAtTime
      integrationId
      integrationLabel
      integrationType
      isEditable
      isHealthy
      lastEventProcessedAtTime
      lastEventReceivedAtTime
      lastModified
      logTypes
    }
  }
}
```

#### S3 로그 소스 업데이트

아래 예시 요청에서 `input` 는 업데이트된 S3 로그 소스를 완전히 나타내는 객체입니다. 표시된 모든 필드는 필수입니다. 왜냐하면 `updateS3Source` 기존 로그 소스의 모든 필드를 대체하기 때문입니다(특정 필드만 업데이트하는 것이 아니라).

```graphql
mutation UpdateS3LogSource {
  updateS3Source(
    input: {
      id: "bcd45662-bab7-4f99-b69f-083a0212568d"
      label: "My Log Source2"
      kmsKey: ""
      logProcessingRole: "arn:aws:iam::0123456789012:role/PantherLogProcessingRole-somerole"
      logStreamType: JSON
      managedBucketNotifications: false
      s3PrefixLogTypes: [
        { excludedPrefixes: [], logTypes: ["AWS.ALB"], prefix: "" }
      ]
    }
  ) {
    logSource {
      createdAtTime
      integrationId
      integrationLabel
      integrationType
      isEditable
      isHealthy
      lastEventProcessedAtTime
      lastEventReceivedAtTime
      lastModified
      logTypes
    }
  }
}
```


---

# 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/panther/api/graphql/log-source.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.
