devenv: trying to make fluentd with inoffical fluent-plugin-loki work

This commit is contained in:
Marcus Efraimsson
2019-02-08 17:28:15 +01:00
parent 3b0ae4bd0a
commit 0f40b2d206
5 changed files with 82 additions and 1 deletions

View File

@ -7,6 +7,10 @@ services:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
logging:
driver: "fluentd"
options:
tag: nginx
db:
image: mysql:5.6
@ -73,6 +77,10 @@ services:
depends_on:
db:
condition: service_healthy
logging:
driver: "fluentd"
options:
tag: grafana
prometheus:
image: prom/prometheus:v2.4.2
@ -82,3 +90,21 @@ services:
- VIRTUAL_HOST=prometheus.loc
ports:
- 9090
loki:
image: grafana/loki:master
environment:
- VIRTUAL_HOST=loki.loc
ports:
- 3100
command: -config.file=/etc/loki/local-config.yaml
fluentd:
build: ./fluentd
volumes:
- ./fluentd/fluent.conf:/fluentd/etc/fluent.conf
links:
- loki
ports:
- "24224:24224"
- "24224:24224/udp"

View File

@ -0,0 +1,30 @@
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

View File

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

View File

@ -0,0 +1,19 @@
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match **>
@type stdout
format json
</match>
<match **>
@type loki
endpoint_url "http://loki:3100"
labels {"env":"dev"}
flush_interval 10s
flush_at_shutdown true
buffer_chunk_limit 1m
</match>

View File

@ -8,4 +8,9 @@ datasources:
jsonData:
timeInterval: 10s
queryTimeout: 30s
httpMethod: POST
httpMethod: POST
- name: Loki
type: loki
access: proxy
url: http://loki:3100