> 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) 로그를 Panther로 전달할 때 Fluentd 대신 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 format` 섹션에서는 `single_value` 유형을 사용합니다.
* 다음의 조합은 `none` 구문 분석과 `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` 아래 구성으로 설정하세요. 다음 항목을 업데이트했는지 확인하세요: `리전`, `delivery_stream_name`, 그리고 `role_arn`:\\

   ```
   <source>  
     @type tail
     tag 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
     tag 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 min partition
       timekey_wait 2m
       timekey_use_utc true # use 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.
