Kubernetes pod fluentd forward to fluentd DaemonSet

314 views Asked by At

As we know we can deploy fluentd as DaemonSet in EKS

it can log all the stdout / stderr from the pod

however if a php application write a log into a file, the fluentd in DaemonSet will not catch the content of the file

how do we make it happen?

im thinking put another fluentd container into the pod, and then tail the log file, and then forward it to other fluentd in DaemonSet

e.g

laravel.input.conf: |-
    <source>
      @type tail
      format multiline
      multiline_flush_interval 1s
      format_firstline /\[\d{4}-\d{1,2}-\d{1,2} \d{2}:\d{2}:\d{2}\]/
      format1 /^\[(?<time>[^\]]*)\] (?<environment>[^ ]*) (?<severity>[^ ]*): (?<message>.*)$/
      time_format %Y-%m-%d %H:%M:%S
      path /var/log/laravel.log
      pos_file /var/log/laravel.log.pos
      tag myapp.laravel
    </source>

is it possible

and how do make it happen?

1

There are 1 answers

0
Jason Yi On

Why not just write out to stdout or error and using fluentd:

<source>
    @type tail
    @id in_tail_containers_logs
    path /var/log/containers/*.log
    ....
</source>