Skip to content
This repository was archived by the owner on Aug 17, 2023. It is now read-only.

Commit c9a3d8f

Browse files
committed
Allow configuring custom plugins/stores/filters for fluentd
1 parent 1e51e75 commit c9a3d8f

6 files changed

Lines changed: 59 additions & 0 deletions

File tree

rootfs/opt/fluentd/sbin/boot

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#!/bin/bash
22
FLUENTD_CONF="/opt/fluentd/conf/fluentd.conf"
33

4+
if [ $INSTALL_BUILD_TOOLS == "true" ]
5+
then
6+
apt-get update
7+
apt-get install -y \
8+
g++ \
9+
gcc \
10+
make \
11+
ruby \
12+
ruby-dev
13+
fi
14+
15+
source /opt/fluentd/sbin/plugins
416
source /opt/fluentd/sbin/sources
517
source /opt/fluentd/sbin/filters/filters
618

@@ -15,4 +27,15 @@ cat << EOF >> $FLUENTD_CONF
1527
</match>
1628
EOF
1729

30+
if [ $INSTALL_BUILD_TOOLS == "true" ]
31+
then
32+
apt-get remove -y --auto-remove --purge \
33+
g++ \
34+
gcc \
35+
make \
36+
ruby-dev
37+
apt-get clean
38+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
39+
fi
40+
1841
exec fluentd -c $FLUENTD_CONF
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FILTERS=$(env | grep -E '^(CUSTOM_FILTER_\d*)' | sed 's/=.*//')
2+
3+
for filter in $FILTERS
4+
do
5+
echo "Configuring $filter"
6+
conf=$(eval "echo \"\$$filter\"")
7+
if [ -n "$conf" ]
8+
then
9+
echo -e "\n# $filter" >> $FLUENTD_CONF
10+
echo "$conf" >> $FLUENTD_CONF
11+
fi
12+
done
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
22
source /opt/fluentd/sbin/filters/kubernetes
3+
source /opt/fluentd/sbin/filters/custom_filters

rootfs/opt/fluentd/sbin/plugins

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
PLUGINS=$(env | grep -E '^(FLUENTD_PLUGIN_\d*)' | sed 's/=.*//')
2+
for plugin_var in $PLUGINS
3+
do
4+
plugin=$(eval "echo \$$plugin_var")
5+
if [ -n "$plugin" ]
6+
then
7+
echo "Installing fluentd plugin $plugin."
8+
fluent-gem install --no-document $plugin
9+
fi
10+
done
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
STORES=$(env | grep -E '^(CUSTOM_STORE_\d*)' | sed 's/=.*//')
2+
3+
for store in $STORES
4+
do
5+
echo "Configuring $store"
6+
conf=$(eval "echo \"\$$store\"")
7+
if [ -n "$conf" ]
8+
then
9+
echo -e "\n# $store" >> $FLUENTD_CONF
10+
echo "$conf" >> $FLUENTD_CONF
11+
fi
12+
done

rootfs/opt/fluentd/sbin/stores/stores

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ source /opt/fluentd/sbin/stores/deis
44
source /opt/fluentd/sbin/stores/elastic_search
55
source /opt/fluentd/sbin/stores/syslog
66
source /opt/fluentd/sbin/stores/sumologic
7+
source /opt/fluentd/sbin/stores/custom_stores

0 commit comments

Comments
 (0)