Compare commits

..

1 Commits

Author SHA1 Message Date
3ec0498098 Init elastic 2018-11-30 17:18:29 +01:00
7 changed files with 96 additions and 79 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
tags
storage
influxdb/

View File

@ -1,18 +0,0 @@
log:
level: DEBUG
providers:
docker:
exposedByDefault: true
network: inbound
defaultRule: "Host(`{{ trimPrefix `/` .Name }}.docker.localhost`)"
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
api:
dashboard: true
debug: true
global:
sendAnonymousUsage: false
checkNewVersion: true

View File

@ -1,11 +1,9 @@
version: '3.8'
version: '2'
services:
consul:
image: consul
restart: always
container_name: consul
container_name: consul_elena
command: consul agent -server -dev -client=0.0.0.0 -ui -bootstrap -log-level warn -datacenter dev
environment:
SERVICE_8400_NAME: consul
@ -18,28 +16,16 @@ services:
- "8400:8400"
- "8500:8500"
- "8600:8600/udp"
expose:
- "8500"
networks:
- inbound
labels:
- "traefik.docker.network=inbound"
- "traefik.http.routers.consul.rule=Host(`consul.docker.localhost`)"
- "traefik.http.routers.consul.service=consul"
- "traefik.http.services.consul.loadbalancer.server.port=8500"
registrator:
restart: always
container_name: registrator
container_name: registrator_elena
depends_on:
- consul
image: gliderlabs/registrator:master
command: -ttl=120 -ttl-refresh=10 -cleanup=true -resync=10 -internal consul://consul:8500
command: -internal consul://consul:8500
volumes:
- /var/run/docker.sock:/tmp/docker.sock
networks:
- inbound
links:
- consul
environment:
@ -47,54 +33,52 @@ services:
portainer:
restart: always
container_name: portainer
image: portainer/portainer-ce:latest
container_name: portainer_elena
image: portainer/portainer
command: -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./storage/portainer:/data
networks:
- inbound
labels:
- "traefik.docker.network=inbound"
- "traefik.http.routers.portainer.rule=Host(`portainer.docker.localhost`)"
- "traefik.http.routers.portainer.service=portainer"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
- portainer_data:/data
traefik:
image: traefik:latest
container_name: traefik
fluentd:
build: ./fluentd
restart: always
networks:
- traefik
- inbound
container_name: fluentd_elena
volumes:
- ./configs/traefik.yml:/etc/traefik/traefik.yml
- /var/run/docker.sock:/var/run/docker.sock
- ./fluentd/conf:/fluentd/etc
links:
- "influxdb"
ports:
- target: 80
published: 80
mode: host
- target: 443
published: 443
mode: host
- target: 8080
published: 8090
protocol: tcp
mode: ingress
labels:
- "traefik.http.routers.api.rule=Host(`traefik.docker.localhost`)"
- "traefik.http.routers.api.service=api@internal"
- 24224:24224
environment:
SERVICE_24224_NAME: 'fluentd'
SERVICE_5140_NAME: 'fluentd'
influxdb:
image: influxdb:latest
restart: always
container_name: influxdb_elena
volumes:
- ./storage/influxdb/data:/var/lib/influxdb
environment:
INFLUXDB_DATA_ENGINE: 'tsm1'
INFLUXDB_REPORTING_DISABLED: 'false'
SERVICE_8086_NAME: 'influxdb'
elasticsearch:
image: elasticsearch:6.5.1
expose:
- 9200
ports:
- "9200:9200"
kibana:
image: kibana:6.5.1
links:
- "elasticsearch"
ports:
- "5601:5601"
networks:
traefik:
driver: bridge
name: traefik
inbound:
driver: bridge
name: inbound
configs:
traefik_config:
file: ./configs/traefik.yml
volumes:
portainer_data:

26
fluent.conf Normal file
View File

@ -0,0 +1,26 @@
<source>
@type forward
@id input1
@label @mainstream
port ${LISTEN_PORT}
source_hostname_key hostname
</source>
<label @mainstream>
<filter **>
@type record_transformer
<record>
tag ${tag}
hostname ${hostname}
</record>
</filter>
<match **>
type influxdb
host ${DB_HOST}
port ${DB_PORT}
dbname ${DB_NAME}
collection ${DB_COLLECTION}
flush_interval ${FLUSH_INTERVAL}
</match>
</label>

3
fluentd/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM fluent/fluentd:latest
RUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-rdoc", "--no-ri"]

23
fluentd/conf/fluent.conf Normal file
View File

@ -0,0 +1,23 @@
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match *.**>
@type copy
<store>
@type elasticsearch
host elastic_elena
logstash_format true
logstash_prefix fluentd
logstash_dateformat %Y%m%d
include_tag_key true
type_name access_log
tag_key @log_name
flush_interval 1s
</store>
<store>
@type stdout
</store>
</match>

0
plugins/.gitkeep Normal file
View File