Skip to content

Commit 6ebceef

Browse files
Merge pull request #2112 from alanconway/fluentd-plugin-loki
Add fluentd-plugin-grafana-loki to fluentd image
2 parents 53b271b + 25cc56f commit 6ebceef

File tree

13 files changed

+925
-98
lines changed

13 files changed

+925
-98
lines changed

HACKING.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,11 @@ images into a public registry like `quay.io`).
1111

1212
## Deploying to OpenShift
1313

14-
See the [cluster-logging-operator](https://github.com/openshift/cluster-logging-operator/blob/master/docs/HACKING.md) hacking document for deploying OpenShift Logging using the operator make targets.
14+
See the [cluster-logging-operator](https://github.com/openshift/cluster-logging-operator/blob/master/docs/HACKING.md) hacking document for deploying OpenShift Logging using the operator make targets.
1515

1616
## Updating Sources for Fluentd
1717

18-
Use the script `hack/update-fluentd-vendor-gems.sh` to update the vendored source
19-
code for Fluentd. It is highly recommended to use something like [rvm](https://rvm.io) in order to isolate specific gem versions being used by Fluentd.
20-
21-
**Note:** Be sure to add `fluentd/rh-manifest.txt`
22-
or add it to the commit if it was updated.
23-
24-
### Add a new dependency or update a dependency version
25-
1. Use a ruby version: `rvm use $RUBY-VERSION`
26-
1. Create a gemset: `rvm gemset create $GEMSETNAME`
27-
1. Use gemset: `rvm gemset use $GEMSETNAME`
28-
1. Edit: `./fluentd/Gemfile`
29-
1. Vendor dependencies: `./hack/update-fluentd-vendor-gems.sh`
18+
See [fluentd/README.md](fluentd/README.md)
3019

3120
### Updating all the dependencies
3221

@@ -39,5 +28,4 @@ Set the clobber env var: `CLOBBER_VENDOR=true ./hack/update-fluentd-vendor-gems.
3928

4029
Edit the file `fluentd/source.jemalloc` to also update the
4130
vendored jemalloc source. You will have to use `git add` or `git rm` or otherwise
42-
fix any conflicts, then commit and submit a PR.
43-
31+
fix any conflicts, then commit and submit a PR.

fluentd/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gem 'fluent-plugin-cloudwatch-logs'
88
gem 'fluent-plugin-concat'
99
gem 'fluent-plugin-elasticsearch'
1010
gem 'fluent-plugin-kafka'
11+
gem 'fluent-plugin-grafana-loki'
1112
gem 'fluent-plugin-multi-format-parser'
1213
gem 'fluent-plugin-record-modifier'
1314
gem 'fluent-plugin-rewrite-tag-filter'

fluentd/Gemfile.lock

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,18 @@ GEM
5555
elasticsearch
5656
excon
5757
fluentd (>= 0.14.22)
58+
fluent-plugin-grafana-loki (1.2.7)
59+
fluentd (>= 0.14.10, < 2)
5860
fluent-plugin-kafka (0.13.1)
5961
fluentd (>= 0.14.10, < 2)
6062
ltsv
6163
ruby-kafka (>= 0.7.8, < 2)
62-
fluent-plugin-label-router (0.2.4)
63-
fluentd (>= 0.14.10, < 2)
6464
fluent-plugin-kubernetes_metadata_filter (2.5.2)
6565
fluentd (>= 0.14.0, < 1.12)
6666
kubeclient (< 5)
6767
lru_redux
68+
fluent-plugin-label-router (0.2.4)
69+
fluentd (>= 0.14.10, < 2)
6870
fluent-plugin-multi-format-parser (1.0.0)
6971
fluentd (>= 0.14.0, < 2)
7072
fluent-plugin-prometheus (1.7.3)
@@ -175,6 +177,7 @@ DEPENDENCIES
175177
fluent-plugin-cloudwatch-logs
176178
fluent-plugin-concat
177179
fluent-plugin-elasticsearch
180+
fluent-plugin-grafana-loki
178181
fluent-plugin-kafka
179182
fluent-plugin-kubernetes_metadata_filter
180183
fluent-plugin-label-router

fluentd/README.md

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Fluentd
2+
23
[Fluentd](https://www.fluentd.org/) is the log collector that resides on each OpenShift node to gather application and node logs
4+
35
## Configuration
46
This image is intended to be run in conjunction with the configuration and `run.sh` files provided by the [cluster-logging-operator](https://github.com/openshift/cluster-logging-operator). Experiences with the image outside that context may vary.
7+
58
## Utilities
69
Several utilities are available with the final image.
10+
711
### sanitize_msg_chunks
812
Sanitize file buffer chunks by removing corrupt records.
913

@@ -19,48 +23,86 @@ file chunk, perform a limited set of operations to confirm message validity. Use
1923
the files before running this utility.
2024

2125
## Hacking
26+
2227
This repo vendors the dependencies required to build the final image. Following are instructions for hacking on fluentd.
28+
2329
### Directories
30+
2431
Dependencies are organized according in several basic directories:
2532
* `lib` - Dependencies for which this repo is considered the single source of truth. This is where we make changes that are permanent forks of other libraries or libraries that do not have any other upstream
2633
* `vendored_gem_src` - Dependencies that are copied in from upstream sources based on what is defined in the `Gemfile`. Changes should never be made to content in this directory as it is likely to be clobbered on updates
2734

2835

2936
### Modifying a gem Dependency
30-
Modifying or updating any of the gems requires a local ruby installation. The version of ruby should match that defined in the `Dockerfile`. It is highly recommended to setup the environment using something like [rvm](https://rvm.io/) which makes it possible to install multiple versions of ruby and define sets of gems. The following instructions assume the use of rvm.
31-
#### Install ruby
37+
38+
Modifying or updating any of the gems requires a local ruby installation.
39+
The version of ruby should match the ruby version in the first line of `Dockerfile`.
40+
It is highly recommended to setup the environment using something like [rvm](https://rvm.io/) which makes it possible to install multiple versions of ruby and define sets of gems.
41+
42+
#### Install Ruby
43+
44+
The version of ruby should match the ruby version in the first line of `Dockerfile`.
45+
3246
```
33-
$ rvm install ruby-2.5
34-
$ rvm use ruby-2.5
47+
rvm install ruby-2.5
48+
rvm use ruby-2.5
3549
```
36-
#### Install Vendored gems
37-
Gems required by fluentd are maintained in the [Gemfile](https://bundler.io/gemfile.html) which is the list of dependencies. The repository also includes the `Gemfile.lock` which is the explicit list of the versions of the dependencies being used including the transitive ones.
50+
51+
#### Install Vendored Gems
52+
53+
Gems required by fluentd are maintained in the [Gemfile](https://bundler.io/gemfile.html) which is the list of dependencies. The repository also includes the `Gemfile.lock` which is the explicit list of the versions of the dependencies being used including the transitive ones.
54+
55+
Note the bundler version should match the version from the end of `Gemfile.lock`
3856

3957
```
40-
$ rvm gemset create fluentd
41-
$ rvm gemset use fluentd
42-
$ gem install bundler -v 1.17.3
43-
$ bundle install
58+
rvm gemset create fluentd
59+
rvm gemset use fluentd
60+
gem install bundler -v 1.17.3
61+
bundle install
4462
```
63+
4564
#### Updating Vendored Gems
46-
* Edit the Gemfile as needed
65+
66+
* Edit `Gemfile` to add new gems.
4767
* Run the update script from the repo root dir
48-
* Commit changes and rebuild image
68+
```
69+
cd ..
70+
./hack/update-fluentd-vendor-gems.sh
71+
```
72+
* Commit changes and rebuild images
73+
74+
**Note:** The hack script accepts the following env vars:
75+
76+
* `BUNDLE_TASK=install`: (default) download and install all missing Gems.
77+
* `BUNDLE_TASK=update SOMEGEM` : update a single gem to latest.
78+
* `BUNDLE_TASK=update` : update _all_ the gems to latest.
79+
**Note**: Not to be undertaken lightly!
80+
* `CLOBBER_VENDOR`: If set remove everything in `vendored_gem_src` for cases where the intent is to clean up the vendored gems to remove unused dependencies
81+
82+
If you get an error like this:
83+
84+
``` shell
85+
[32mFetching fluent-plugin-kafka 0.13.1[0m
86+
[31mDownloading fluent-plugin-kafka-0.13.1 revealed dependencies not in the API or the lockfile
87+
(fluentd (>= 0.10.58, < 2)).
4988
```
50-
$ ./hack/update-fluentd-vendor-gems.sh
89+
90+
This may help (replace the plugin name and version appropriately)
91+
``` shell
92+
gem uninstall fluent-plugin-kafka
93+
gem install fluent-plugin-kafka --version 0.13.1
5194
```
52-
**Note:** The hack script accepts the following env vars:
53-
* `BUNDLE_TASK`: 'install'(default) or 'update' to modify what bundler is doing. 'update' may be used if the intent is to update all the gems to the latest. This will also update the `Gemfile.lock` which should additionally be committed.
54-
* `CLOBBER_VENDOR`: This removes everything in `vendored_gem_src` for cases where the intent is to clean up the vendored gems to remove unused dependencies
5595
5696
#### Make lib Changes
97+
5798
* May need to install additional dependencies from `lib/<gemdir>` using `bundle install`
5899
* Make any needed changes to the files in lib
59100
* Test change `bundle exec rake test`
60101
* Commit change and rebuild image
61102
62103
### Building the Container Image
104+
63105
Build the container image from the fluentd directory like:
64106
```
65107
$ podman build -t fluentd:test .
66-
```
108+
```

fluentd/rh-manifest.txt

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,78 @@
1+
addressable 2.7.0 https://github.com/sporkmonger/addressable
12
aws-eventstream 1.1.0 https://github.com/aws/aws-sdk-ruby
23
aws-partitions 1.396.0 https://github.com/aws/aws-sdk-ruby
34
aws-sdk-cloudwatchlogs 1.38.0 https://github.com/aws/aws-sdk-ruby
45
aws-sdk-core 3.109.3 https://github.com/aws/aws-sdk-ruby
56
aws-sigv4 1.2.2 https://github.com/aws/aws-sdk-ruby
7+
bigdecimal 3.0.0 https://github.com/ruby/bigdecimal
8+
concurrent-ruby 1.1.6 http://www.concurrent-ruby.com
9+
connection_pool 2.2.3 https://github.com/mperham/connection_pool
10+
cool.io 1.6.0 http://coolio.github.com
611
digest-crc 0.6.1 https://github.com/postmodern/digest-crc#readme
712
dig_rb 1.0.1 https://github.com/jrochkind/dig_rb
13+
domain_name 0.5.20190701 https://github.com/knu/ruby-domain_name
14+
elasticsearch 7.8.0 https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.x/index.html
15+
elasticsearch-api 7.8.0 https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.x/index.html
16+
elasticsearch-transport 7.8.0 https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.x/index.html
17+
ethon 0.12.0 https://github.com/typhoeus/ethon
18+
excon 0.75.0 https://github.com/excon/excon
19+
faraday 1.0.1 https://lostisland.github.io/faraday
20+
ffi 1.11.3 https://github.com/ffi/ffi/wiki
821
ffi-compiler 1.0.1 http://wiki.github.com/ffi/ffi
922
fluent-config-regexp-type 1.0.0 https://github.com/okkez/fluent-config-regexp-type
1023
fluentd 1.7.4 https://www.fluentd.org/
24+
fluent-mixin-config-placeholders 0.4.0 https://github.com/tagomoris/fluent-mixin-config-placeholders
1125
fluent-plugin-cloudwatch-logs 0.7.6 https://github.com/fluent-plugins-nursery/fluent-plugin-cloudwatch-logs
1226
fluent-plugin-concat 2.4.0 https://github.com/fluent-plugins-nursery/fluent-plugin-concat
27+
fluent-plugin-elasticsearch 4.1.1 https://github.com/uken/fluent-plugin-elasticsearch
28+
fluent-plugin-grafana-loki 1.2.7 https://github.com/grafana/loki/
1329
fluent-plugin-kafka 0.13.1 https://github.com/fluent/fluent-plugin-kafka
30+
fluent-plugin-kubernetes_metadata_filter 2.5.2 https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter
1431
fluent-plugin-label-router 0.2.4 https://github.com/banzaicloud/fluent-plugin-label-router
1532
fluent-plugin-multi-format-parser 1.0.0 https://github.com/repeatedly/fluent-plugin-multi-format-parser
33+
fluent-plugin-prometheus 1.7.3 https://github.com/fluent/fluent-plugin-prometheus
34+
fluent-plugin-record-modifier 2.1.0 https://github.com/repeatedly/fluent-plugin-record-modifier
35+
fluent-plugin-remote-syslog 1.1 https://github.com/docebo/fluent-plugin-remote-syslog
36+
fluent-plugin-rewrite-tag-filter 2.3.0 https://github.com/fluent/fluent-plugin-rewrite-tag-filter
1637
fluent-plugin-splunk-hec 1.1.2 https://github.com/splunk/fluent-plugin-splunk-hec
38+
fluent-plugin-systemd 1.0.2 https://github.com/reevoo/fluent-plugin-systemd
39+
http 4.4.1 https://github.com/httprb/http
1740
http-accept 1.7.0 https://github.com/ioquatix/http-accept
41+
http-cookie 1.0.3 https://github.com/sparklemotion/http-cookie
42+
http-form_data 2.3.0 https://github.com/httprb/form_data.rb
1843
http-parser 1.2.1 https://github.com/cotag/http-parser
44+
http_parser.rb 0.6.0 http://github.com/tmm1/http_parser.rb
1945
jemalloc 5.2.1 https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2
2046
jmespath 1.4.0 http://github.com/trevorrowe/jmespath.rb
2147
jsonpath 1.0.5 https://github.com/joshbuddy/jsonpath
48+
kubeclient 4.8.0 https://github.com/abonas/kubeclient
49+
lru_redux 1.1.0 https://github.com/SamSaffron/lru_redux
2250
ltsv 0.1.2 https://github.com/condor/ltsv
23-
rubygem-addressable 2.7.0 https://github.com/sporkmonger/addressable
24-
rubygem-bigdecimal 3.0.0 https://github.com/ruby/bigdecimal
25-
rubygem-concurrent-ruby 1.1.6 http://www.concurrent-ruby.com
26-
rubygem-connection_pool 2.2.3 https://github.com/mperham/connection_pool
27-
rubygem-cool.io 1.6.0 http://coolio.github.com
28-
rubygem-domain_name 0.5.20190701 https://github.com/knu/ruby-domain_name
29-
rubygem-elasticsearch 7.8.0 https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.x/index.html
30-
rubygem-elasticsearch-api 7.8.0 https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.x/index.html
31-
rubygem-elasticsearch-transport 7.8.0 https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.x/index.html
32-
rubygem-ethon 0.12.0 https://github.com/typhoeus/ethon
33-
rubygem-excon 0.75.0 https://github.com/excon/excon
34-
rubygem-faraday 1.0.1 https://lostisland.github.io/faraday
35-
rubygem-ffi 1.11.3 https://github.com/ffi/ffi/wiki
36-
rubygem-fluent-mixin-config-placeholders 0.4.0 https://github.com/tagomoris/fluent-mixin-config-placeholders
37-
rubygem-fluent-plugin-elasticsearch 4.1.1 https://github.com/uken/fluent-plugin-elasticsearch
38-
rubygem-fluent-plugin-kubernetes_metadata_filter 2.5.2 https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter
39-
rubygem-fluent-plugin-prometheus 1.7.3 https://github.com/fluent/fluent-plugin-prometheus
40-
rubygem-fluent-plugin-record-modifier 2.1.0 https://github.com/repeatedly/fluent-plugin-record-modifier
41-
rubygem-fluent-plugin-remote-syslog 1.1 https://github.com/docebo/fluent-plugin-remote-syslog
42-
rubygem-fluent-plugin-rewrite-tag-filter 2.3.0 https://github.com/fluent/fluent-plugin-rewrite-tag-filter
43-
rubygem-fluent-plugin-systemd 1.0.2 https://github.com/reevoo/fluent-plugin-systemd
44-
rubygem-http 4.4.1 https://github.com/httprb/http
45-
rubygem-http-cookie 1.0.3 https://github.com/sparklemotion/http-cookie
46-
rubygem-http-form_data 2.3.0 https://github.com/httprb/form_data.rb
47-
rubygem-http_parser.rb 0.6.0 http://github.com/tmm1/http_parser.rb
48-
rubygem-kubeclient 4.8.0 https://github.com/abonas/kubeclient
49-
rubygem-lru_redux 1.1.0 https://github.com/SamSaffron/lru_redux
50-
rubygem-mime-types 3.3.1 https://github.com/mime-types/ruby-mime-types/
51-
rubygem-mime-types-data 3.2020.0512 https://github.com/mime-types/mime-types-data/
52-
rubygem-msgpack 1.3.3 http://msgpack.org/
53-
rubygem-multi_json 1.15.0 https://github.com/intridea/multi_json
54-
rubygem-multipart-post 2.1.1 https://github.com/nicksieger/multipart-post
55-
rubygem-net-http-persistent 3.1.0 http://docs.seattlerb.org/net-http-persistent
56-
rubygem-netrc 0.11.0 https://github.com/geemus/netrc
57-
rubygem-oj 3.11.3 http://www.ohler.com/oj
58-
rubygem-prometheus-client 0.9.0 https://github.com/prometheus/client_ruby
59-
rubygem-public_suffix 4.0.5 https://simonecarletti.com/code/publicsuffix-ruby
60-
rubygem-quantile 0.2.1 http://github.com/matttproud/ruby_quantile_estimation
61-
rubygem-rake 13.0.1 https://github.com/ruby/rake
62-
rubygem-recursive-open-struct 1.1.2 https://github.com/aetherknight/recursive-open-struct
63-
rubygem-rest-client 2.1.0 https://github.com/rest-client/rest-client
64-
rubygem-sigdump 0.2.4 https://github.com/frsyuki/sigdump
65-
rubygem-syslog_protocol 0.9.2 https://github.com/eric/syslog_protocol
66-
rubygem-systemd-journal 1.3.3 https://github.com/ledbettj/systemd-journal
67-
rubygem-typhoeus 1.4.0 https://github.com/typhoeus/typhoeus
68-
rubygem-tzinfo 2.0.2 https://tzinfo.github.io
69-
rubygem-tzinfo-data 1.2020.1 https://tzinfo.github.io
70-
rubygem-unf 0.1.4 https://github.com/knu/ruby-unf
71-
rubygem-unf_ext 0.0.7.7 https://github.com/knu/ruby-unf_ext
72-
rubygem-uuidtools 2.1.5 https://github.com/sporkmonger/uuidtools
73-
rubygem-yajl-ruby 1.4.1 http://github.com/brianmario/yajl-ruby
51+
mime-types 3.3.1 https://github.com/mime-types/ruby-mime-types/
52+
mime-types-data 3.2020.0512 https://github.com/mime-types/mime-types-data/
53+
msgpack 1.3.3 http://msgpack.org/
54+
multi_json 1.15.0 https://github.com/intridea/multi_json
55+
multipart-post 2.1.1 https://github.com/nicksieger/multipart-post
56+
net-http-persistent 3.1.0 http://docs.seattlerb.org/net-http-persistent
57+
netrc 0.11.0 https://github.com/geemus/netrc
58+
oj 3.11.3 http://www.ohler.com/oj
59+
prometheus-client 0.9.0 https://github.com/prometheus/client_ruby
60+
public_suffix 4.0.5 https://simonecarletti.com/code/publicsuffix-ruby
61+
quantile 0.2.1 http://github.com/matttproud/ruby_quantile_estimation
62+
rake 13.0.1 https://github.com/ruby/rake
63+
recursive-open-struct 1.1.2 https://github.com/aetherknight/recursive-open-struct
64+
rest-client 2.1.0 https://github.com/rest-client/rest-client
7465
ruby-kafka 1.1.0 https://github.com/zendesk/ruby-kafka
7566
serverengine 2.2.1 https://github.com/fluent/serverengine
67+
sigdump 0.2.4 https://github.com/frsyuki/sigdump
7668
strptime 0.2.4 https://github.com/nurse/strptime
69+
syslog_protocol 0.9.2 https://github.com/eric/syslog_protocol
70+
systemd-journal 1.3.3 https://github.com/ledbettj/systemd-journal
7771
to_regexp 0.2.1 https://github.com/seamusabshere/to_regexp
72+
typhoeus 1.4.0 https://github.com/typhoeus/typhoeus
73+
tzinfo 2.0.2 https://tzinfo.github.io
74+
tzinfo-data 1.2020.1 https://tzinfo.github.io
75+
unf 0.1.4 https://github.com/knu/ruby-unf
76+
unf_ext 0.0.7.7 https://github.com/knu/ruby-unf_ext
77+
uuidtools 2.1.5 https://github.com/sporkmonger/uuidtools
78+
yajl-ruby 1.4.1 http://github.com/brianmario/yajl-ruby

0 commit comments

Comments
 (0)