> 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/general-log-forwarding-via-fluentd.md).

# Fluentd를 통한 일반 로그 전달

## 개요

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

이 문서는 S3와 Fluentd를 통해 파일의 원시 로그를 Panther로 전달하는 가이드입니다. 아래 Fluentd 구성은 데이터를 사전 처리하지 않고, 대신 파일의 내용을 있는 그대로 전달합니다. 이 가이드는 다음을 수행하는 방법을 안내합니다:

* 장치에 Fluentd를 설치합니다.
* AWS Firehose 또는 S3 플러그인을 통해 Fluentd 구성을 편집합니다.
* Fluentd 인스턴스를 시작하고 올바르게 실행 중인지 확인합니다.

### 사전 요구 사항

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

## Panther에 원시 로그를 전달하도록 Fluentd 설정

### 1단계: Fluentd 설치

다음을 따르세요 [Fluentd 설치 가이드](https://docs.fluentd.org/installation) syslog 메시지를 수집하려는 서버 환경에 대한 것입니다. 설치가 완료되면 아래 터미널 구성을 진행하여 Fluentd를 올바르게 구성할 수 있습니다.

### 2단계: Fluentd 구성 편집

{% hint style="info" %}
Fluentd를 구성할 때는 Firehose 플러그인 또는 S3 플러그인 두 가지 옵션이 있습니다. Panther에서는 더 성능이 좋은 옵션이므로 Firehose 플러그인 옵션을 권장합니다. 하지만 둘 다 로그를 S3로 전달합니다. \\

구성에는 두 가지 인증 유형이 표시됩니다. 역할 수임 또는 액세스 키입니다. 환경에 가장 적합한 인증 유형을 사용하세요.
{% endhint %}

Fluentd에서 아래 플러그인 구성에 유의하세요:

* 해당 `<source>` 섹션은 tail 플러그인을 사용하여 로그 파일을 읽습니다.
* 해당 `<parse>` 섹션은 Fluentd가 다음을 사용해 어떠한 파싱도 수행하지 않도록 지시합니다 `@type none`.
* 다음 내부에서 `match 형식` 섹션에서는 `single_value` type이 사용됩니다.
* 다음의 조합은 `없음` 파싱과 `single_value` format은 Fluentd가 데이터를 있는 그대로 출력하도록 합니다.

#### **구성 1: Firehose 플러그인 사용(권장)**

다음을 활용하려면 Fluentd용 Firehose 플러그인을 설치해야 합니다: `@type kinesis 플러그인`**.**

1. **설치** 다음 [Fluentd 플러그인](https://github.com/awslabs/aws-fluent-plugin-kinesis#installation) 아래 명령으로.\\

   ```yaml
   td-agent-gem install fluent-plugin-kinesis
   ```
2. **편집** 다음 위치에 있는 Fluentd 구성 `/etc/td-agent/td-agent.conf` 아래 구성으로 설정합니다. 다음을 업데이트해야 합니다: `region`, `delivery_stream_name`, 그리고 `role_arn`:\\

   ```
   <source>  
     @type tail
     태그 syslog
     path /path/to/file/*.log
     pos_file /var/log/td-agent/pos_file.pos
     <parse>
       @type none
     </parse>
   </source>

   <match syslog.**>
     @type kinesis_firehose
     region <FIREHOSE-REGION>
     delivery_stream_name <FIREHOSE-NAME>

     <assume_role_credentials>
       duration_seconds 3600
       role_arn <FIREHOSE-ROLE-ARN>
       role_session_name "#{Socket.gethostname}-panther-audit"
     </assume_role_credentials>
     <format>
       @type single_value
     </format>
   </match>
   ```

#### **구성 2: S3 플러그인 사용**

1. **편집** 다음 위치에 있는 Fluentd 구성 `/etc/td-agent/td-agent.conf,` 아래 구성으로 설정합니다. 다음을 업데이트해야 합니다: `s3_bucket`, `s3_region`, `aws_key_id`, 그리고 `aws_sec_key`:\\

   ```
   <source>  
     @type tail
     태그 syslog
     path /path/to/file/*.log
     pos_file /var/log/td-agent/pos_file.pos
     <parse>
       @type none
     </parse>
   </source>

   <match syslog.**>
     @type s3
     aws_key_id <ACCESS-KEY-ID>
     aws_sec_key <SECRET-KEY>
     s3_bucket <BUCKET-NAME>
     s3_region <BUCKET-REGION>
     path syslog/%Y/%m/%d/
     store_as gzip
     <buffer tag,time>
       @type file
       path /var/log/td-agent/buffer/s3
       timekey 300 # 5분 파티션
       timekey_wait 2m
       timekey_use_utc true # UTC 사용
       chunk_limit_size 256m
     </buffer>
     <format>
       @type single_value
     </format>
   </match>
   ```

### 3단계: Fluentd 시작

1. Fluentd 구성을 완료한 후, 터미널에서 아래 명령을 실행하세요:\\

   ```
   $ sudo systemctl start td-agent.service 
   ```
2. Fluentd가 올바르게 실행 중인지 확인하려면, 터미널에서 아래 명령을 실행하세요:\\

   ```
   $ sudo systemctl status td-agent.service
   ```

{% hint style="info" %}
만약 `systemctl` 당신의 Fluentd 환경에서 사용할 수 없는 경우, 다음을 참조하세요: [Fluentd 설치 가이드](https://docs.fluentd.org/installation).
{% endhint %}


---

# 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/general-log-forwarding-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.
