Infrastructure/Fluentd

[Fluentd] 6. 서버간 연동

상쾌한기분 2021. 5. 11. 14:48
728x90
반응형

서버간 연동

aggregator 서버

<source>
  @type forward
  @id input_forward
  port 24232
  bind 0.0.0.0
</source>

<match nginx.**>
    @type stdout
    @id output_nginx

    @log_level debug
</match>

forwarder 서버

<source>
  @type tail
  @label @NGINX_LOG
  @id NGINX_ACCESS_LOG

  tag nginx.access
  path /var/log/nginx/access.log
  pos_file /var/log/td-agent/nginx-access.log.pos

  <parse>
    @type nginx
  </parse>
</source>

<source>
  @type tail
  @label @NGINX_LOG
  @id NGINX_ERROR_LOG

  tag nginx.error
  path /var/log/nginx/error.log
  pos_file /var/log/td-agent/nginx-error.log.pos

  <parse>
    @type nginx
  </parse>
</source>
#############################################

<label @NGINX_LOG>
  <match nginx.*>
    @type forward
    @id output_nginx

    send_timeout 60s
    recover_wait 10s
    hard_timeout 60s

    <server>
      name main_node
      host 192.168.10.7
      port 24232
      weight 60
    </server>

    <secondary>
      @type file
      path /var/log/td-agent/td-agnt-nginx-fail.log
    </secondary>

    @log_level debug
  </match>
</label>

<source>
  @type forward
  @id input_forward
  port 24232
  bind 0.0.0.0
</source>

<match apps.**>
    @type forward
    @id output_apps

    send_timeout 60s
    recover_wait 10s
    hard_timeout 60s

    <server>
      name main_node
      host 192.168.10.7
      port 24232
      weight 60
    </server>

    <secondary>
      @type file
      path /var/log/td-agent/td-agnt-nginx-fail.log
    </secondary>
</match>

728x90
반응형