구상 파일 위치는 /fluentd/etc/fleunt.conf

sudo yum install docker -y
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo chmod 666 /var/run/docker.sock

docker pull fluent/fluentd:v1.16-1

cat <<EOF > Dockerfile
FROM fluent/fluentd:v1.16-1

COPY ./fluent.conf /fluentd/etc/fluent.conf
EOF

cat <<EOF > fluent.conf
<source>
  @type tail
  path /var/log/logf/app.log
  pos_file /var/log/logf/app.log.pos
  tag app
  <parse>
    @type regexp
    expression \\[GIN\\]([\\s]+)(?<request_time>[^|]+)([\\s]+)\\|([\\s]+)(?<status>[\\S]+)([\\s]+)\\|([\\s]+)([\\S]+) \\|([\\s]+)(?<ip>[\\S]+)([\\s]+)\\|([\\s]+)(?<client_method>[\\S]+)([\\s]+)(?<path>[\\S]+)
  </parse>
</source>

<filter **>
  @type record_transformer
  enable_ruby
  <record>
    path ${record["path"].gsub('"', '')}
  </record>
</filter>

<match **>
  @type stdout
</match>
EOF

docker build -t my-fluent:latest .
docker run -v /home/ec2-user/:/var/log/logf/ my-fluent:latest # 수정