본문 바로가기
Fluentd

Fluentd Overview/ Default install



1.Fluentd 소개

Fluented는 오픈 소스 데이터 수집기로서, 데이터의  수집과소비 (ouput/input) 최적화된 log aggregator
기본 구조는 Flume-NG, Logstash 와 같은 다른 log aggregator 와 유사한 형태로 Input,Buffer,Output 의 형태를 갖는다.
기본적으로 C로 구성 되어 있으며, plugin 은 ruby로 구성 되어 있다.

아래와 같이 다양한 형태의 input 을 통하여 다양한 형태의 output 을 제공 한다.
지원하는 여러 형태는 https://www.fluentd.org/datasources 통하여 확인 가능 하다.



2.Fluentd 설치 

Hostname
Private IP
CPU
Memory
OS
fluentd 버전 
CY5
192.168.0.205
Xeon(R)L5630 @ 2.13GH
2G
Centos 6.8 64bit
td-agent-2.3.5-0.el6.x86_64
# Fluentd 의존성있는  redhat-lsb-core 패키지 설치

[root@CY5 ~]# yum install -y  redhat-lsb-core

# Fluentd rpm 파일 다운로드 및 설치 

[root@CY5 ~]# rpm -Uvh td-agent-2.3.5-0.el6.x86_64.rpm                                                              
준비 중...               ########################################### [100%]
   1:td-agent               ########################################### [100%]
adding 'td-agent' group...
adding 'td-agent' user...
Installing default conffile...
prelink detected. Installing /etc/prelink.conf.d/td-agent-ruby.conf ...
Configure td-agent to start, when booting up the OS...
[root@CY5 ~]# rpm -qa | grep td-agent
td-agent-2.3.5-0.el6.x86_64

# Fluentd 실행 
[root@CY5 ~]# /etc/init.d/td-agent start


3.Fluentd 설정 

# 기존 초기 설정을 백업
[root@CY5 ~]# mv /etc/td-agent/td-agent.conf /etc/td-agent/td-agent.conf_bak

# 새로운 설정으로 테스트 진행 한다.
# fluentd 설정은 크게 source 와 match 로 구분 된다. source 에서는 input data 를 어떻게 받을 것인지 정의 하고 match 에서 해당 되는 input data 를 어떻게 처리 할 것인지
정의 한다.
# 아래 테스트 설정은 http 형식으로 8989 포트로 받아서 모든 match 되는 것을 stdoutput 으로 보낸다. stdoutput 할경우 기본 로그 위치인 var/log/td-agent/td-agent.log  로 append 된다 .

[root@CY5 ~]# vi /etc/td-agent/td-agent.conf
<source>
  type http
  port 8989
</source>
<match  **>
  type stdout
</match>
# 설정을 변경한 뒤 curl 로 테스트 하여 로그가 쌓이는지 확인 한다.


[root@CY5 ~]# /etc/init.d/td-agent restart
[root@CY5 ~]# curl -X POST -d 'json={"test":"cy"}' http://localhost:8989/test;     
[root@CY5 ~]# tail -f /var/log/td-agent/td-agent.log                                     
  <source>
    type http
    port 8989
  </source>

  <match **>
    type stdout
  </match>
</ROOT>
2017-09-27 11:14:31 +0900 test: {"test":"cy"}

참조사이트 : https://www.fluentd.org/






반응형

'Fluentd' 카테고리의 다른 글

Fluent Bit -> Fluentd -> elasticsearch  (1) 2018.06.09
Fluentd output for kafka  (0) 2017.09.30