Ver Fonte

devenv: use grafana/fluent-plugin-loki

Marcus Efraimsson há 6 anos atrás
pai
commit
7b1249ad47

+ 5 - 7
devenv/docker/ha_test/docker-compose.yaml

@@ -7,10 +7,6 @@ services:
       - "80:80"
     volumes:
       - /var/run/docker.sock:/tmp/docker.sock:ro
-    logging:
-      driver: "fluentd"
-      options:
-        tag: nginx
 
   db:
     image: mysql:5.6
@@ -51,7 +47,7 @@ services:
   #     retries: 10
 
   grafana:
-    image: grafana/grafana:dev
+    image: grafana/grafana:6.0.0-beta2
     volumes:
       - ./grafana/provisioning/:/etc/grafana/provisioning/
     environment:
@@ -70,6 +66,8 @@ services:
       # - GF_DATABASE_SSL_MODE=disable
       # - GF_SESSION_PROVIDER=postgres
       # - GF_SESSION_PROVIDER_CONFIG=user=grafana password=password host=db port=5432 dbname=grafana sslmode=disable
+      - GF_SERVER_ROUTER_LOGGING=true
+      - GF_LOG_CONSOLE_FORMAT=json
       - GF_LOG_FILTERS=alerting.notifier:debug,alerting.notifier.slack:debug,auth:debug
       - GF_AUTH_TOKEN_ROTATION_INTERVAL_MINUTES=2
     ports:
@@ -100,9 +98,9 @@ services:
     command: -config.file=/etc/loki/local-config.yaml
 
   fluentd:
-    build: ./fluentd
+    image: grafana/fluent-plugin-loki:master
     volumes:
-      - ./fluentd/fluent.conf:/fluentd/etc/fluent.conf
+      - ./fluentd/fluentd.conf:/fluentd/etc/fluentd.conf
     links:
       - loki
     ports:

+ 0 - 30
devenv/docker/ha_test/fluentd/Dockerfile

@@ -1,30 +0,0 @@
-FROM fluent/fluentd:v1.3.3-debian-1.0
-
-# USER root
-
-# RUN apk add --no-cache --update --virtual .build-deps \
-#         sudo build-base ruby-dev \
-#  && sudo gem install bundler \
-#  && gem 'loki', git: 'https://github.com/grafana/loki.git', glob: 'fluentd/fluent-plugin-loki/*.gemspec' \
-#  && sudo gem sources --clear-all \
-#  && apk del .build-deps \
-#  && rm -rf /home/fluent/.gem/ruby/2.5.0/cache/*.gem
-
-# USER fluent
-
-USER root
-
-COPY Gemfile .
-RUN ["gem", "install", "fluent-plugin-loki"]
-
-# RUN apt-get -y update \
-#  && apt-get -y install git \
-#  && apt-get clean \
-#  && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man/?? /usr/share/man/??_*
-
-# RUN gem install bundler \
-#  && bundler install
-
-# COPY fluent.conf /fluentd/etc
-
-USER fluent

+ 0 - 1
devenv/docker/ha_test/fluentd/Gemfile

@@ -1 +0,0 @@
-source 'https://rubygems.org'

+ 5 - 8
devenv/docker/ha_test/fluentd/fluent.conf → devenv/docker/ha_test/fluentd/fluentd.conf

@@ -4,15 +4,12 @@
   bind 0.0.0.0
 </source>
 
-<match **>
-  @type stdout
-  format json
-</match>
-
-<match **>
+<match grafana>
   @type loki
-  endpoint_url "http://loki:3100"
-  labels {"env":"dev"}
+  url "http://loki:3100"
+  extra_labels {"app":"grafana"}
+  label_keys "container_name,container_id"
+  line_format "json"
   flush_interval 10s
   flush_at_shutdown true
   buffer_chunk_limit 1m

+ 8 - 0
devenv/docker/ha_test/prometheus/prometheus.yml

@@ -36,4 +36,12 @@ scrape_configs:
         - 'mysqld-exporter'
         type: 'A'
         port: 9104
+        refresh_interval: 10s
+
+  - job_name: 'loki'
+    dns_sd_configs:
+      - names:
+        - 'loki'
+        type: 'A'
+        port: 3100
         refresh_interval: 10s