[Fluentd] 5. Output plugin

2021. 5. 11. 14:47·Infrastructure/Fluentd
반응형

Output Plugin

https://docs.fluentd.org/output

file

file 은 이름처럼 데이터를 파일로 생성

<match pattern>
  @type file
  path /var/log/fluent/myapp
  compress gzip
  <buffer>
    timekey 1d
    timekey_use_utc true
    timekey_wait 10m
  </buffer>
</match>

forward

output 에서 forward 는
local fluentd 데이터를 external fluentd 로 전송해 줌

아래 보면 myserver1과 myserver2 로 local event data를 전송해주고
운영시에 장애가 발생해도 문제 없이 운영이 가능 하도록 2개의 서버로 데이터를 보내는 것 유추 쌉가능

<match pattern>
  @type forward
  send_timeout 60s
  recover_wait 10s
  hard_timeout 60s

  <server>
    name myserver1
    host 192.168.1.3
    port 24224
    weight 60
  </server>
  <server>
    name myserver2
    host 192.168.1.4
    port 24224
    weight 60
  </server>
  ...

  <secondary>
    @type file
    path /var/log/fluent/forward-failed
  </secondary>
</match>

http

http 는 HTTP/HTTPS Domain 으로 데이터를 전송해 줌
method 는 post, put 을 제공하며, content-type 도 설정 가능하다

<match pattern>
  @type http

  endpoint http://logserver.com:9000/api
  open_timeout 2

  <format>
    @type json
  </format>
  <buffer>
    flush_interval 10s
  </buffer>
</match>

secondary_file

secondary_file 은 사용하는 output plugin 에서 혹시 몰라서 백업용으로 사용하는 plugin 이고, main 으로 사용하지 말라고 함

<match pattern>
  @type forward
  # ...
  <secondary>
    @type secondary_file
    directory /var/log/fluentd/error
  </secondary>
</match>

stdout

디버깅, 테스트 용으로 사용하면 됨
systemd 로 실행시키면 agent log 에 찍히고
직접 호출 실행을 하면 리눅스 화면에 로그가 찍힘

<match apps.**>
  @type stdout
</match>

이후 다른 flugin들에 대해서는 스스로 학습 하도록 하자
728x90
반응형
저작자표시 비영리 (새창열림)
'Infrastructure/Fluentd' 카테고리의 다른 글
  • [Fluentd] 7. Nginx 연동
  • [Fluentd] 6. 서버간 연동
  • [Fluentd] 4. Input plugin
  • [Fluentd] 3. 설정 파라미터
상쾌한기분
상쾌한기분
  • 상쾌한기분
    상쾌한기분
    상쾌한기분
  • 전체
    오늘
    어제
    • 분류 전체보기 (251)
      • Python (44)
        • Python (26)
        • Django (6)
        • Flask (4)
        • Open Source (6)
      • Kotlin & Java (5)
        • Spring (2)
        • 프로젝트 (1)
      • Go (11)
      • Database (24)
        • MySQL (21)
        • Redis (3)
      • Infrastructure (2)
        • CDC (4)
        • Kafka (5)
        • Prometheus (2)
        • Fluentd (11)
        • Docker (1)
        • Airflow (2)
        • VPN (2)
      • IT (26)
        • AI (9)
        • Langchain (8)
        • Web (18)
        • Git (8)
        • 리팩토링 (9)
        • Micro Service Architecture (8)
        • Clean Code (16)
        • Design Pattern (0)
        • 수학 (1)
        • 알고리즘 (14)
      • OS (14)
        • Centos (10)
        • Ubuntu (3)
        • Mac (1)
      • Search Engine (2)
        • ElasticSearch (1)
        • Lucene Solr (1)
      • PHP (2)
        • Laravel (1)
        • Codeigniter (1)
  • 블로그 메뉴

    • Github 방문
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    ollama
    http
    Redis
    오블완
    티스토리챌린지
    MYSQL
    LLM
    performance
    백준
    Langchain
    go
    CDC
    git
    prompt
    python
    파이썬
    fluentd
    Kafka
    docker
    Golang
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
상쾌한기분
[Fluentd] 5. Output plugin
상단으로

티스토리툴바