Skip to content

Commit

Permalink
Merge pull request #15 from n0n0x/elasticsearch-deis-router-logging
Browse files Browse the repository at this point in the history
feat(fluentd): Allow option to only log router logs to elasticsearch
  • Loading branch information
Cryptophobia authored Mar 4, 2020
2 parents 5ec8d92 + 69ab98a commit 2e1af4d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apk add --update --virtual .build-deps sudo build-base ruby-dev \
&& bundle install --gemfile=/fluentd/deis-output/Gemfile \
&& rake --rakefile=/fluentd/deis-output/Rakefile build \
&& fluent-gem install --no-document fluent-plugin-kubernetes_metadata_filter -v 2.1.4 \
&& fluent-gem install --no-document fluent-plugin-elasticsearch -v 2.12.0 \
&& fluent-gem install --no-document fluent-plugin-elasticsearch -v 4.0.4 \
&& fluent-gem install --no-document fluent-plugin-remote_syslog -v 1.0.0 \
&& fluent-gem install --no-document fluent-plugin-sumologic-mattk42 -v 0.0.4 \
&& fluent-gem install --no-document fluent-plugin-gelf-hs -v 1.0.7 \
Expand Down
25 changes: 25 additions & 0 deletions rootfs/fluentd/sbin/boot
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ cat << EOF >> $FLUENTD_CONF
EOF
fi

# If you want to ONLY log deis router logs to elasticsearch
# then we Gclose the previous <match> tag and create a new one
# just for matching deis-router logs. Output would be like:
# <match kubernetes.var.log.containers.deis-router-**.log>
# @type copy
# <store>
# @type elasticsearch
# ...
# </store>
# </match>
if [ -n "${ELASTICSEARCH_DEIS_ROUTER_LOGS_ONLY}" ]
then
cat << EOF >> $FLUENTD_CONF
<match kubernetes.var.log.containers.deis-router-**.log>
@type copy
EOF

source /fluentd/sbin/stores/elastic_search
source /fluentd/sbin/stores/stores

cat << EOF >> $FLUENTD_CONF
</match>
EOF
fi

cat << EOF >> $FLUENTD_CONF
<match **>
@type copy
Expand Down
2 changes: 1 addition & 1 deletion rootfs/fluentd/sbin/stores/stores
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

source /fluentd/sbin/stores/deis
source /fluentd/sbin/stores/elastic_search
[ -z "${ELASTICSEARCH_DEIS_ROUTER_LOGS_ONLY}" ] && source /fluentd/sbin/stores/elastic_search
source /fluentd/sbin/stores/syslog
source /fluentd/sbin/stores/sumologic
source /fluentd/sbin/stores/custom_stores
Expand Down

0 comments on commit 2e1af4d

Please sign in to comment.