Created
March 3, 2016 13:39
-
-
Save toddlers/28a437165d6f31a4c250 to your computer and use it in GitHub Desktop.
docker-composeでfluentd + elasticsearch + kibana4 環境をつくる ref: http://qiita.com/cgetc/items/345e3c686910b30ba49f
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
| fluentd: | |
| build: ./fluentd | |
| links: | |
| - "elasticsearch" | |
| # Fluentd logging driver対応の場合 | |
| ports: | |
| - "22422:22422" | |
| # Fluentd logging driver非対応の場合 | |
| volumes: | |
| - /var/lib/docker/containers:/var/lib/docker/containers | |
| - /var/run:var/run | |
| - /var/log/docker:/var/log/docker | |
| elasticsearch: | |
| build: elasticsearch | |
| expose: | |
| - 9200 | |
| kibana: | |
| image: kibana | |
| links: | |
| - "elasticsearch" | |
| ports: | |
| - "5601:5601" |
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
| FROM kiyoto/fluentd:0.10.56-2.1.1 | |
| MAINTAINER kiyoto@treausure-data.com | |
| RUN mkdir /etc/fluent | |
| ADD fluent.conf /etc/fluent/ | |
| RUN ["apt-get", "update"] | |
| RUN ["apt-get", "install", "--yes", "make", "libcurl4-gnutls-dev"] | |
| RUN ["/usr/local/bin/gem", "install", "fluent-plugin-elasticsearch", "--no-rdoc", "--no-ri"] | |
| RUN ["/usr/local/bin/gem", "install", "fluent-plugin-record-reformer", "--no-rdoc", "--no-ri"] | |
| RUN ["/usr/local/bin/gem", "install", "fluent-plugin-docker-tag-resolver", "--no-rdoc", "--no-ri"] | |
| ENTRYPOINT ["/usr/local/bin/fluentd", "-c", "/etc/fluent/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
| mkdir -p flutend/plugins |
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
| FROM fluent/fluentd | |
| RUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-rdoc", "--no-ri"] |
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
| docker-compose up -d |
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
| FROM kiyoto/fluentd:0.10.56-2.1.1 | |
| MAINTAINER kiyoto@treausure-data.com | |
| RUN mkdir /etc/fluent | |
| ADD fluent.conf /etc/fluent/ | |
| RUN ["apt-get", "update"] | |
| RUN ["apt-get", "install", "--yes", "make", "libcurl4-gnutls-dev"] | |
| RUN ["/usr/local/bin/gem", "install", "fluent-plugin-elasticsearch", "--no-rdoc", "--no-ri"] | |
| RUN ["/usr/local/bin/gem", "install", "fluent-plugin-record-reformer", "--no-rdoc", "--no-ri"] | |
| RUN ["/usr/local/bin/gem", "install", "fluent-plugin-docker-tag-resolver", "--no-rdoc", "--no-ri"] | |
| ENTRYPOINT ["/usr/local/bin/fluentd", "-c", "/etc/fluent/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
| FROM elasticsearch | |
| RUN echo "network.bind_host: 0.0.0.0" >> /usr/share/elasticsearch/config/elasticsearch.yml |
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
| docker-compose up -d |
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 tail | |
| path /var/lib/docker/containers/*/*-json.log | |
| pos_file /var/log/fluentd-docker.pos | |
| time_format %Y-%m-%dT%H:%M:%S | |
| tag docker.log.* | |
| format json | |
| </source> | |
| <match docker.log.**> | |
| type docker_tag_resolver | |
| </match> | |
| <match docker.container.**> | |
| type record_reformer | |
| container_id ${tag_parts[4]} | |
| container_name ${tag_parts[3]} | |
| tag docker.all | |
| </match> | |
| <match docker.all> | |
| type elasticsearch | |
| log_level debug | |
| host elasticsearch | |
| port 9200 | |
| include_tag_key true | |
| logstash_format true | |
| flush_interval 5s | |
| </match> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment