Skip to content
Snippets Groups Projects
Unverified Commit a161e02a authored by David's avatar David Committed by GitHub
Browse files

Merge pull request #390 from SvenDowideit/add-default-loki-fluentd-conf

Use the example fluentd conf files, and show a way to use them
parents 94a74400 e197d93b
No related branches found
No related tags found
No related merge requests found
......@@ -10,26 +10,29 @@ ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1
COPY docker/Gemfile* /fluentd/
RUN buildDeps="sudo make gcc g++ libc-dev ruby-dev" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
$buildDeps libsystemd0 net-tools libjemalloc1 \
&& gem install bundler --version 1.16.2 \
&& bundle config silence_root_warning true \
&& bundle install --gemfile=/fluentd/Gemfile --path=/fluentd/vendor/bundle \
&& sudo gem sources --clear-all \
&& SUDO_FORCE_REMOVE=yes \
apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
$buildDeps \
&& rm -rf /var/lib/apt/lists/* \
/home/fluent/.gem/ruby/2.3.0/cache/*.gem \
/tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
ENV FLUENTD_CONF="/fluentd/etc/fluentd.conf"
ENV FLUENTD_OPT=""
&& apt-get update \
&& apt-get install -y --no-install-recommends \
$buildDeps libsystemd0 net-tools libjemalloc1 \
&& gem install bundler --version 1.16.2 \
&& bundle config silence_root_warning true \
&& bundle install --gemfile=/fluentd/Gemfile --path=/fluentd/vendor/bundle \
&& sudo gem sources --clear-all \
&& SUDO_FORCE_REMOVE=yes \
apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
$buildDeps \
&& rm -rf /var/lib/apt/lists/* \
/home/fluent/.gem/ruby/2.3.0/cache/*.gem \
/tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
COPY docker/entrypoint.sh /fluentd/entrypoint.sh
COPY lib/fluent/plugin/out_loki.rb /fluentd/plugins/out_loki.rb
COPY docker/conf/ /fluentd/etc/loki/
ENV FLUENTD_CONF="/fluentd/etc/loki/fluentd.conf"
ENV FLUENTD_OPT=""
ENV LOKI_URL "https://logs-us-west1.grafana.net"
# See https://packages.debian.org/stretch/amd64/libjemalloc1/filelist
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.1"
......
......@@ -29,6 +29,44 @@ In your Fluentd configuration, use `@type loki`. Additional configuration is opt
</match>
```
## Docker Image
There is a Docker image `grafana/fluent-plugin-loki:master` which contains default configuration files to git log information
a host's `/var/log` dir, and from the host's Journald. To use it, you can set the `LOKI_URL`, `LOKI_USERNAME`, and `LOKI_PASSWORD` environment variables (you can leave the USERNAME and PASSWORD blank if they're not used.)
A Docker Swarm Compose configuration that will work looks like:
```
services:
fluentd:
image: grafana/fluent-plugin-loki:master
command:
- "fluentd"
- "-v"
- "-p"
- "/fluentd/plugins"
environment:
LOKI_URL: http://loki:3100
LOKI_USERNAME:
LOKI_PASSWORD:
deploy:
mode: global
configs:
- source: loki_config
target: /fluentd/etc/loki/loki.conf
networks:
- loki
volumes:
- host_logs:/var/log
# Needed for journald log ingestion:
- /etc/machine-id:/etc/machine-id
- /dev/log:/dev/log
- /var/run/systemd/journal/:/var/run/systemd/journal/
logging:
options:
tag: infra.monitoring
```
## Configuration
......
<match journald>
@type loki
url "https://logs-us-west1.grafana.net"
url "#{ENV['LOKI_URL']}"
username "#{ENV['LOKI_USERNAME']}"
password "#{ENV['LOKI_PASSWORD']}"
extra_labels {"env":"dev"}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment