docker

Docker for services
git clone git://git.unixkoans.com/docker.git
Log | Files | Refs

commit 5939ee75548cb31b3ebba472e93642f1496df0be
parent 97ef760e6e03efc51594be79a04a8963bcd73ed1
Author: Xiaodong Xu <xuxd@inedcn.com>
Date:   Tue May 29 14:37:23 +0800

Add Fluent

Diffstat:
fluentd/Dockerfile | 15+++++++++++++++
fluentd/docker-compose.yml | 10++++++++++
fluentd/fluent.conf | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/fluentd/Dockerfile b/fluentd/Dockerfile @@ -0,0 +1,15 @@ +FROM fluent/fluentd:v0.12-onbuild + +RUN apk add --update --virtual .build-deps \ + sudo build-base ruby-dev \ + # cutomize following instruction as you wish + && sudo gem install \ + fluent-plugin-secure-forward \ + fluent-plugin-grepcounter \ + fluent-plugin-mail \ + && sudo gem sources --clear-all \ + && apk del .build-deps \ + && rm -rf /var/cache/apk/* \ + /home/fluent/.gem/ruby/2.3.0/cache/*.gem + +EXPOSE 24284 diff --git a/fluentd/docker-compose.yml b/fluentd/docker-compose.yml @@ -0,0 +1,10 @@ +version: '2' + +services: + fluent: + image: fluent:custom + restart: always + ports: + - 24224:24224 + volumes: + - ./log:/fluentd/log diff --git a/fluentd/fluent.conf b/fluentd/fluent.conf @@ -0,0 +1,54 @@ +<source> + @type forward + @id input1 + @label @mainstream + port 24224 +</source> + +<filter **> + @type stdout +</filter> + +<label @mainstream> + <match docker.**> + @type file + @id output_docker1 + path /fluentd/log/docker.*.log + symlink_path /fluentd/log/docker.log + append true + time_slice_format %Y%m%d + time_slice_wait 1m + time_format %Y%m%dT%H%M%S%z + </match> + <match **> + @type file + @id output1 + path /fluentd/log/data.*.log + symlink_path /fluentd/log/data.log + append true + time_slice_format %Y%m%d + time_slice_wait 10m + time_format %Y%m%dT%H%M%S%z + </match> + <match **> + @type grepcounter + count_interval 60 + input_key log + regexp ERROR + threshold 1 + add_tag_prefix error + </match> + <match error.**> + @type mail + host smtp.exmail.qq.com + port 465 + user contact@medatc.com + password Maileich1quae.go + enable_starttls_auto true + from contact@medatc.com + to xuxiaodong@medatc.com + subject 'SERVER ERROR' + message %s + message_out_keys log + </match> +</label>