> 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/syslog-to-s3-via-fluentd.md).

# Fluentd를 통해 Syslog를 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를 사용하여 syslog 메시지를 S3로 전달하는 방법을 제공합니다. 두 가지 서로 다른 파이프라인 흐름이 있습니다: AWS Firehose 전송 스트림을 통해서와 AWS S3 버킷으로 직접 전달하는 방법입니다.

### 사전 요구 사항

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

## Fluentd 설정

### 1단계. Fluentd 설치

다음을 따르세요 [Fluentd 설치 가이드](https://docs.fluentd.org/installation) syslog 메시지를 수집하려는 서버의 환경에 맞게.

### 2단계. Fluentd 설정 편집

Fluentd를 구성할 때는 두 가지 옵션이 있습니다: Firehose 플러그인 또는 S3 플러그인 사용. 아래에는 두 옵션의 구성 파일이 있습니다.

두 옵션 중 성능이 더 좋은 Firehose 플러그인 옵션을 권장하지만, 둘 다 로그를 S3로 전송합니다. 구성에는 두 가지 인증 유형인 역할 수임과 액세스 키가 표시되어 있습니다. 환경에 가장 적합한 인증 유형을 사용하세요.

#### **Firehose 플러그인 사용(권장)**

다음 Fluentd [플러그인](https://github.com/awslabs/aws-fluent-plugin-kinesis#installation):

```
td-agent-gem install fluent-plugin-kinesis
```

Fluentd 설정을 편집하세요`/etc/td-agent/td-agent.conf` 아래 설정을 사용하세요. 이렇게 하면 Fluentd가 UDP 포트 5140에서 syslog 이벤트를 수신하고 Kinesis Firehose로 출력할 수 있습니다. 아래의 `region`, `delivery_stream_name` 및 `role_arn` 를 구성에서 업데이트하세요:

```
<source>
  @type syslog
  port 5140
  bind 0.0.0.0
  tag syslog
  <parse>
    message_format auto
  </parse>
</source>

<filter syslog.** >
  @type record_transformer
  <record>
    tag ${tag}
    time ${time}
  </record>
</filter>

<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 json
  </format>
</match>
```

#### **S3 플러그인 사용**

Fluentd 설정을 편집하세요 `/etc/td-agent/td-agent.conf` 아래 설정을 사용하세요. 이렇게 하면 Fluentd가 UDP 포트 5140에서 syslog 이벤트를 수신하고 S3 버킷으로 출력할 수 있습니다. 아래의 `s3_bucket`, `s3_region`, `aws_key_id`, 및 `aws_sec_key` 를 구성에서 업데이트하세요:

```
<source>
  @type syslog
  port 5140
  bind 0.0.0.0
  tag syslog
  <parse>
    message_format auto
  </parse>
</source>

<filter syslog.** >
  @type record_transformer
  <record>
    tag ${tag}
    time ${time}
  </record>
</filter>

<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 json
  </format>
</match>
```

### 3단계: Fluentd 시작

Fluentd를 구성한 후 아래 명령을 실행하여 시작하세요:

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

Fluentd가 실행 중인지 확인하세요:

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

다음을 참조하세요 [Fluentd 설치 가이드](https://docs.fluentd.org/installation) 환경에서 Fluentd를 시작하는 방법을 `systemctl` 사용할 수 없는 경우.

## rsyslog 구성

### rsyslog를 로컬 Fluentd로 전달하도록 구성

구성 `rsyslog` 메시지를 로컬 Fluentd 데몬으로 전달하도록 하려면 다음 두 줄을 아래에 추가하세요: `/etc/rsyslog.d/50-default.conf` 또는 `/etc/rsyslog.conf` 일부 환경에서는:

```
# Fluentd로 로그 메시지 전송
*.* @127.0.0.1:5140
```

아래 명령으로 rsyslog를 다시 시작하세요:

```
$ sudo systemctl restart rsyslog.service
```

{% hint style="info" %}
이 단계는 다른 서버에서도 복제하여 이 가이드에서 이전에 구성한 Fluentd 서버로 syslog를 전달할 수 있습니다. 로컬 주소만 `*.* @127.0.0.1:5140` Fluentd 서버의 IP 주소로 바꾸면 됩니다. 서버로 UDP/5140 트래픽을 전송할 수 있도록 보안 그룹이나 호스트 기반 방화벽을 업데이트해야 할 수 있습니다.
{% endhint %}

## 로깅 확인

5\~10분이 지난 후 syslog 메시지가 S3 버킷에 기록되고 있는지 확인하세요. 로그는 버킷 내 다음 경로 아래에 표시되어야 합니다: `syslog/` 버킷 내 prefix입니다.

이제 S3 버킷을 온보딩하고 다음을 사용하여 Panther UI에서 데이터를 온보딩할 수 있습니다. `Fluentd.Syslog3164` 로그 유형.


---

# 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/syslog-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.
