Created
June 13, 2019 06:11
-
-
Save mrk21/fa5e2e527efb3b59ac50bc84219ce583 to your computer and use it in GitHub Desktop.
Fluent config sample that outputs logs to stdout, S3 and Cloudwatch Logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: '3.5' | |
services: | |
fluentd: | |
build: | |
context: . | |
dockerfile: docker/fluentd/Dockerfile | |
target: base | |
ports: | |
- ${DOCKER_HOST_FLUENTD_PORT:-24224}:24224 | |
- ${DOCKER_HOST_FLUENTD_PORT:-24224}:24224/udp | |
volumes: | |
- ./docker/fluentd/fluent.conf:/fluentd/etc/fluent.conf:ro | |
environment: | |
AWS_REGION: ${FLUENTD_AWS_REGION:-} | |
AWS_ACCESS_KEY_ID: ${FLUENTD_AWS_ACCESS_KEY_ID:-} | |
AWS_SECRET_ACCESS_KEY: ${FLUENTD_AWS_SECRET_ACCESS_KEY:-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for development | |
FROM fluent/fluentd as base | |
RUN gem install fluent-plugin-s3 -v 1.1.10 --no-document | |
RUN gem install fluent-plugin-cloudwatch-logs -v 0.7.3 --no-document | |
# for production | |
FROM base AS bundle | |
COPY docker/fluentd/fluent.conf /fluentd/etc/fluent.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<source> | |
@type forward | |
@label @applog | |
port 24224 | |
bind 0.0.0.0 | |
</source> | |
<label @applog> | |
<match lograge.*> | |
@type copy | |
<store> | |
@type stdout | |
</store> | |
<store> | |
@type s3 | |
aws_key_id "#{ENV['AWS_ACCESS_KEY_ID']}" | |
aws_sec_key "#{ENV['AWS_SECRET_ACCESS_KEY']}" | |
s3_region "#{ENV['AWS_REGION']}" | |
s3_bucket fluentd-test | |
path app/lograge/%Y-%m-%d/ | |
s3_object_key_format %{path}%{index}.%{file_extension} | |
time_slice_format %Y/%m/%d | |
<format> | |
@type json | |
</format> | |
<buffer time> | |
@type file | |
path /tmp | |
timekey 1m | |
timekey_wait 0 | |
</buffer> | |
</store> | |
<store> | |
@type cloudwatch_logs | |
log_group_name fluentd-test | |
log_stream_name fluentd-test | |
auto_create_stream true | |
</store> | |
</match> | |
</label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment