> 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/data-onboarding/data-pipeline-tools/fluentd/macos-system-logs-to-s3-via-fluentd.md).

# Fluentd를 통해 MacOS 시스템 로그를 S3로

## 개요

{% hint style="warning" %}
다음 사용을 고려하세요 [Fluent Bit](/ko/data-onboarding/data-pipeline-tools/fluent-bit-onboarding-guide.md) Panther로 로그를 전달할 때 Fluentd 대신 Fluent Bit 사용을 고려하세요. Fluent Bit은 Fluentd보다 설정이 쉽고 리소스를 덜 사용합니다.
{% endhint %}

이 가이드는 Fluentd를 사용하여 macOS 시스템 로그를 S3로 전송하는 방법을 제공합니다. 파이프라인 흐름은 두 가지입니다. AWS Firehose 전달 스트림을 통한 방식과 AWS S3 버킷으로 직접 전송하는 방식입니다.

### 사전 요구 사항

이 가이드는 S3 버킷 또는 Firehose가 이미 생성되어 있다고 가정합니다. 이러한 리소스를 생성해야 하는 경우 [Fluentd 온보딩 가이드](/ko/data-onboarding/data-pipeline-tools/fluentd.md)를 참조하세요. 이미 리소스를 프로비저닝했다면 아래 가이드를 필요에 맞게 조정할 수 있습니다.

## Fluentd 설정

### 1단계. Fluentd(td-agent) 설치

Fluentd 설치 [지침을](https://docs.fluentd.org/installation/install-by-dmg) 따라 macOS 시스템 로그를 수집하려는 머신에 설치하세요. 이 가이드에서는 로그 수집 서비스로 td-agent를 사용하는 방법을 중점적으로 다룹니다.

### 2단계. macOS 로그용 Fluent 플러그인 설치

아래 명령을 사용하여 Fluentd macOS 플러그인을 설치하세요.

```
sudo /opt/td-agent/bin/fluent-gem install fluent-plugin-macos-log
```

이 플러그인에 대한 추가 문서는 [GitHub](https://github.com/loggly/fluent-plugin-macos-log).

### 3단계. Fluentd 구성 편집

기본으로 포함된 구성 정보는 사용하지 않는 경우 제거할 수 있습니다. 아래 Fluentd 구성을 사용하고 `aws_key_id`, `aws_sec_key`, `s3_bucket`, 및 `s3_region` 정보를 추가하세요.

Fluentd와 td-agent는 서로 충돌하는 포트에서 서비스를 실행하려고 합니다. 새 설치인 경우 구성 파일의 포트를 변경하거나 파일에서 기본 구성을 제거해야 합니다.

```
/etc/td-agent/td-agent.conf
```

```
<source>
  @type macoslog
  style ndjson
  tag macos
  pos_file last-starttime.log
  run_interval 10s
  <parse>
    @type json
    time_type string
    time_key timestamp
    time_format %Y-%m-%d %H:%M:%S.%L%z
  </parse>
</source>

<match **>
  @type s3
  aws_key_id <Key ID>
  aws_sec_key <Key>
  s3_bucket <Bucket>
  s3_region <Region>
  path macoslog/%Y/%m/%d/
  store_as gzip
  <buffer tag,time>
    @type file
    path /var/log/fluent/s3
    timekey 300 # S3에 게시하기 위한 5분 파티션
    timekey_wait 2m
    timekey_use_utc true # UTC 사용
    chunk_limit_size 256m
  </buffer>
  <format>
    @type json
  </format>
</match>
```

### 4단계. Fluentd를 구성 파일에 지정하고 유효성 검사

```
# fluentd를 구성 파일로 지정
fluentd -c /etc/td-agent/td-agent.conf

# 구성 유효성 검사
/opt/td-agent/usr/sbin/td-agent --dry-run
```

### 5단계. 로깅 확인

몇 분 후 이벤트가 S3 버킷에 기록되는지 확인하세요. 로그는 버킷의 `macos/` 접두사 아래에 표시되어야 합니다.

## Panther 콘솔

### 1단계. 사용자 지정 스키마 만들기

이동하세요 **스키마**. 클릭 **+새 스키마** 그런 다음 아래 값을 스키마 필드에 입력하세요:

**이름:** Custom.MacOSSystemLogs\
**설명:** 애플리케이션, 보안, 시스템용 macOS 시스템 로그

```
버전: 0
필드:
- 이름: pid
  유형: bigint
- 이름: ppid
  유형: bigint
- 이름: message
  유형: string
- 이름: worker
  유형: bigint
- 이름: creatorActivityID
  유형: float
- 이름: messageType
  유형: string
- 이름: activityIdentifier
  유형: bigint
- 이름: backtrace
  유형: object
  필드:
  - 이름: frames
    필수: true
    유형: array
    요소:
      유형: object
      필드:
      - 이름: imageOffset
        필수: true
        유형: bigint
      - 이름: imageUUID
        필수: true
        유형: string
- 이름: bootUUID
  유형: string
- 이름: category
  유형: string
- 이름: eventMessage
  유형: string
- 이름: eventType
  유형: string
- 이름: formatString
  유형: string
- 이름: machTimestamp
  유형: bigint
- 이름: parentActivityIdentifier
  유형: bigint
- 이름: processID
  유형: bigint
- 이름: processImagePath
  유형: string
- 이름: processImageUUID
  유형: string
- 이름: senderImagePath
  유형: string
- 이름: senderImageUUID
  유형: string
- 이름: senderProgramCounter
  유형: bigint
- 이름: subsystem
  유형: string
- 이름: threadID
  유형: bigint
- 이름: timezoneName
  유형: string
- 이름: traceID
  유형: float
```

### 2단계. S3 버킷 온보딩 <a href="#step-2.-onboard-the-s3-bucket" id="step-2.-onboard-the-s3-bucket"></a>

다음을 따르세요 [S3 소스](/ko/data-onboarding/data-transports/aws/s3.md) 온보딩 문서를 따르고 이전 설정에서 사용한 S3 버킷을 사용하세요.

로그 유형을 선택하고 `Custom.MacOSSystemLogs` 접두사를 `macos/` 온보딩 단계에서. 버킷 온보딩을 완료하면 이제 데이터가 Panther로 들어와야 합니다!


---

# 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/data-onboarding/data-pipeline-tools/fluentd/macos-system-logs-to-s3-via-fluentd.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.
