fluent-plugin-vmware-loginsight 0.1.10 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18aba45331aaa3aa482ac466fa77747daec97df8e9d31fa231493df9a46c83de
4
- data.tar.gz: 987665db9f586d6a4bde5921a68a9c18555b70000f16e900b29b0480e381593b
3
+ metadata.gz: d8c6cb1363b6364811d6c9d9c1c80067c46ed222eaa2a70034a7f2cd69b2b043
4
+ data.tar.gz: cad2d46faa95261265dc7c8aa2119ce8a389ca641c8ca789079a34a90d32fb19
5
5
  SHA512:
6
- metadata.gz: 68448d50ae0dc8a84bf4f5c17d8a91053b22d240df04c73f2199043a994a95ac7c89ba34281ee5ff623d241d457ad786f8009261c3843ff12a53cdd818b9788e
7
- data.tar.gz: a37769610e800178e2e0c9ea19dd3f58b91ff7b4ff38f9b896c8273d651b949dd52625e3bc310a11dc38e732762053199cccc13f2d8e94beb4b2f298f2c22ed0
6
+ metadata.gz: 320f33af67ad7102ea3212f217b1bcfa23c0a27f37f0b4f4873a66fd716ec4556431b0e14005a732541d985b980de1cb44b7fbde5a7d3dac980944593156ea1e
7
+ data.tar.gz: 1c172ba0c3ea4af9ac2a3e0c28037ff589163dc4b5ff82fc3c70efb7829deca8f0c2c5d4bd9a580bafc104e670e44ad7c322625e60a937ca4b2cc54ebeabd6b7
@@ -0,0 +1,38 @@
1
+ name: Ruby Gem
2
+
3
+ on: workflow_dispatch
4
+
5
+ jobs:
6
+ build:
7
+ name: Build + Publish
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+
17
+ - name: Publish to GPR
18
+ run: |
19
+ mkdir -p $HOME/.gem
20
+ touch $HOME/.gem/credentials
21
+ chmod 0600 $HOME/.gem/credentials
22
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
23
+ gem build *.gemspec
24
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
25
+ env:
26
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
27
+ OWNER: ${{ github.repository_owner }}
28
+
29
+ # - name: Publish to RubyGems
30
+ # run: |
31
+ # mkdir -p $HOME/.gem
32
+ # touch $HOME/.gem/credentials
33
+ # chmod 0600 $HOME/.gem/credentials
34
+ # printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
35
+ # gem build *.gemspec
36
+ # gem push *.gem
37
+ # env:
38
+ # GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/CHANGELOG.md ADDED
@@ -0,0 +1,63 @@
1
+ # Changelog
2
+
3
+ ## v1.0.0 - April 20, 2021
4
+
5
+ * Update plugin structure to use Fluentd 1.x syntax
6
+
7
+ ## v0.1.11 - March 31, 2021
8
+
9
+ * Add an option to rename Loginsight fields. This option could be used to rename certain fields that are reserved by Loginsight
10
+
11
+ ## v0.1.10 - May 13, 2020
12
+
13
+ * Escape `@` char from Loginsight field
14
+
15
+ ## v0.1.9 - May 07, 2020
16
+
17
+ * No change
18
+
19
+ ## v0.1.8 - May 06, 2020 yanked, Not available
20
+
21
+ * Parameterize and add an option to shorten Loginsight field names
22
+
23
+ ## v0.1.7 - December 10, 2019
24
+
25
+ * Fix basic authentication #8
26
+
27
+ ## v0.1.6 - September 13, 2019
28
+
29
+ * For immutable log fields, use a copy to utf encode. This should fix 'can't modify frozen String' error in #5
30
+
31
+ ## v0.1.5 - October 22, 2018
32
+
33
+ * Add option to display debug logs for http connection, default false
34
+ * Flatten Lists/Arrays for LI fields
35
+ * Convert LI field value to String to ensure no utf encoding errors
36
+ * Update help doc/examples with sample use of @log_text_keys and @http_conn_debug options
37
+
38
+ ## v0.1.4 - October 17, 2018
39
+
40
+ * Add option to specify a list of keys that plugin should treat as log messages and forward them as text to Loginsight. Plugin should not flatten these fields
41
+ * If user specifies flatten_hashes option as false, plugin should try to add record key/values as is
42
+
43
+ ## v0.1.3 - September 13, 2018
44
+
45
+ * Reorder namespace and name fields to be shorten
46
+
47
+ ## v0.1.2 - September 10, 2018
48
+
49
+ * Republished yanked gem
50
+
51
+ ## v0.1.1 - August 30, 2018 yanked, Not available
52
+
53
+ * Send log messages in batches, add max_batch_size parameter
54
+ * Shorten common kubernetes Loginsight field names
55
+ * Convert time to milliseconds
56
+
57
+
58
+ ## 0.1.0 - August 30, 2018
59
+
60
+ ### Initial release
61
+
62
+ * Fluentd output plugin to push logs to VMware Log Insight
63
+
data/Dockerfile ADDED
@@ -0,0 +1,68 @@
1
+ # Fluentd plugin for VMware Log Insight
2
+ #
3
+ # Copyright 2019 VMware, Inc. All Rights Reserved.
4
+ #
5
+ # This product is licensed to you under the MIT license (the "License"). You may not use this product except in compliance with the MIT License.
6
+ #
7
+ # This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file.
8
+ #
9
+ # SPDX-License-Identifier: MIT
10
+
11
+ # Builds a photon-based image that contains fluentd, fluent-plugin-vmware-loginsight some of the tools recommended by fluent
12
+ # (libjemalloc, oj, assync-http). This image is based on the minimalistic VMware Photon OS so the result is smaller in size.
13
+ #
14
+ # Fluentd is configured with the default configuration that gets produced by the `fluentd --setup` command. For an example of
15
+ # a configuration that uses the fluent-plugin-vmware-loginsight plugin check fluent.conf under the examples dir:
16
+ # https://github.com/vmware/fluent-plugin-vmware-loginsight/blob/master/examples/fluent.conf
17
+ FROM photon:4.0-20220722
18
+
19
+ USER root
20
+
21
+ RUN buildDeps="\
22
+ binutils linux-api-headers glibc-devel \
23
+ make gcc gmp-devel libffi-devel \
24
+ tar bzip2 sed gawk" \
25
+ #
26
+ # Distro sync and install build dependencies
27
+ && tdnf distro-sync --refresh -y \
28
+ # Toybox conflicts with bzip2. The latter is needed to unpack libjemalloc
29
+ && tdnf remove -y toybox \
30
+ && tdnf install -y $buildDeps ruby \
31
+ #
32
+ # These are not required but are used if available
33
+ && gem install oj -v 3.3.10 \
34
+ && gem install json -v 2.2.0 \
35
+ && gem install async-http -v 0.46.3 \
36
+ #
37
+ # Install fluentd
38
+ && gem install --norc --no-document fluentd -v 1.14.2 \
39
+ && mkdir -p /fluentd/etc /fluentd/plugins \
40
+ #
41
+ # Install Log Insight plugin
42
+ && gem install --norc --no-document -v 0.1.5 fluent-plugin-vmware-loginsight \
43
+ #
44
+ # Install jemalloc 4.5.0
45
+ && curl -L --output /tmp/jemalloc-4.5.0.tar.bz2 https://github.com/jemalloc/jemalloc/releases/download/4.5.0/jemalloc-4.5.0.tar.bz2 \
46
+ && tar -C /tmp/ -xjvf /tmp/jemalloc-4.5.0.tar.bz2 \
47
+ && cd /tmp/jemalloc-4.5.0 \
48
+ && ./configure && make \
49
+ && mv lib/libjemalloc.so.2 /usr/lib \
50
+ && cd / \
51
+ #
52
+ # Cleanup to reduce image size
53
+ && rm -rf /tmp/jemalloc-4.5.0* \
54
+ && tdnf remove -y $buildDeps \
55
+ && tdnf clean all \
56
+ && gem sources --clear-all \
57
+ && gem cleanup
58
+
59
+ # Create default fluent.conf
60
+ RUN fluentd --setup
61
+
62
+ # Make sure fluentd picks jemalloc
63
+ ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"
64
+
65
+ # Standard fluentd ports
66
+ EXPOSE 24224 5140
67
+
68
+ ENTRYPOINT ["/usr/bin/fluentd"]
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # fluent-plugin-vmware-loginsight
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-vmware-loginsight.svg)](https://badge.fury.io/rb/fluent-plugin-vmware-loginsight)
4
+
3
5
  ## Overview
4
6
  output plugin to do forward logs to VMware Log Insight
5
7
 
@@ -28,39 +30,63 @@ $ bundle
28
30
  ## Usage
29
31
 
30
32
  ```
33
+ # Collect all container logs
31
34
  <source>
32
35
  @type tail
36
+ @id in_tail_container_logs
33
37
  path /var/log/containers/*.log
38
+ # One could exclude certain logs like:
39
+ #exclude_path ["/var/log/containers/log-collector*.log"]
34
40
  pos_file /var/log/fluentd-docker.pos
35
- time_format %Y-%m-%dT%H:%M:%S
36
- tag kubernetes.*
37
- format json
38
41
  read_from_head true
42
+ # Set this watcher to false if you have many files to tail
43
+ enable_stat_watcher false
44
+ refresh_interval 5
45
+ tag kubernetes.*
46
+ # Open below line if you need have filename as tag field (now without prefix kubernetes.)
47
+ # path_key tag
48
+ <parse>
49
+ @type json
50
+ time_key time
51
+ keep_time_key true
52
+ time_format %Y-%m-%dT%H:%M:%S.%NZ
53
+ </parse>
39
54
  </source>
40
55
 
41
- # Kubernetes metadata filter that tags additional meta data for each event
42
- <filter kubernetes.var.log.containers.**.log>
56
+ # Kubernetes metadata filter that tags additional meta data for each container event
57
+ <filter kubernetes.**>
43
58
  @type kubernetes_metadata
59
+ @id filter_kube_metadata
60
+ kubernetes_url "#{ENV['FLUENT_FILTER_KUBERNETES_URL'] || 'https://' + ENV.fetch('KUBERNETES_SERVICE_HOST') + ':' + ENV.fetch('KUBERNETES_SERVICE_PORT') + '/api'}"
61
+ verify_ssl "#{ENV['KUBERNETES_VERIFY_SSL'] || true}"
62
+ ca_file "#{ENV['KUBERNETES_CA_FILE']}"
63
+ skip_labels "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_LABELS'] || 'false'}"
64
+ skip_container_metadata "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_CONTAINER_METADATA'] || 'false'}"
65
+ skip_master_url "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_MASTER_URL'] || 'false'}"
66
+ skip_namespace_metadata "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_NAMESPACE_METADATA'] || 'false'}"
44
67
  </filter>
45
68
 
69
+ # Match everything
46
70
  <match **>
47
71
  @type vmware_loginsight
72
+ @id out_vmw_li_all_container_logs
48
73
  scheme https
49
74
  ssl_verify true
50
- # Loginsight host: One may use IP address or cname
51
- # host X.X.X.X
52
- host my-loginsight.mycompany.com
53
- port 9000
54
- path api/v1/events/ingest
75
+ # Loginsight host: One may use IP address or cname
76
+ #host X.X.X.X
77
+ host MY_LOGINSIGHT_HOST
78
+ port 9543
55
79
  agent_id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
56
- http_method post
57
- serializer json
58
- rate_limit_msec 0
59
- raise_on_error false
60
- include_tag_key true
61
- tag_key tag
80
+ # Keys from log event whose values should be added as log message/text to
81
+ # Loginsight. Note these key/value pairs won't be added as metadata/fields
82
+ log_text_keys ["log","msg","message"]
83
+ # Use this flag if you want to enable http debug logs
84
+ http_conn_debug false
62
85
  </match>
63
86
  ```
87
+
88
+ For more examples look at [examples](./examples/)
89
+
64
90
  ### Configuration options
65
91
 
66
92
  ```
@@ -104,18 +130,15 @@ request_timeout, :time, :default => 5
104
130
  # If set, enables debug logs for http connection
105
131
  http_conn_debug, :bool, :default => false :: Valid Value: true | false
106
132
 
133
+ # Number of bytes per post request
134
+ max_batch_size, :integer, :default => 512000
135
+
107
136
  # Simple rate limiting: ignore any records within `rate_limit_msec` since the last one
108
137
  rate_limit_msec, :integer, :default => 0
109
138
 
110
139
  # Raise errors that were rescued during HTTP requests?
111
140
  raise_on_error, :bool, :default => false :: Valid Value: true | false
112
141
 
113
- # Include tag key as log event?
114
- include_tag_key, :bool, :default => true :: Valid Value: true | false
115
-
116
- # Metadata key that identifies Fluentd tags
117
- tag_key, :string, :default => 'tag'
118
-
119
142
  # Keys from log event whose values should be added as log message/text to loginsight.
120
143
  # These key/value pairs won't expanded/flattened and won't be added as metadata/fields.
121
144
  log_text_keys, :array, :default => ["log", "message", "msg"] :: Valid Value: Array of strings
@@ -125,9 +148,35 @@ flatten_hashes, :bool, :default => true :: Valid Value: true | false
125
148
 
126
149
  # Seperator to use for joining flattened keys
127
150
  flatten_hashes_separator, :string, :default => "_"
128
- ```
129
151
 
130
- For more examples look at [examples](./examples/)
152
+ # Rename fields names
153
+ config_param :rename_fields, :hash, default: {"source" => "log_source"}, value_type: :string
154
+
155
+ # Keys from log event to rewrite
156
+ # for instance from 'kubernetes_namespace' to 'k8s_namespace'
157
+ # tags will be rewritten with substring substitution
158
+ # and applied in the order present in the hash
159
+ # (Hashes enumerate their values in the order that the
160
+ # corresponding keys were inserted
161
+ # see https://ruby-doc.org/core-2.2.2/Hash.html)
162
+ # example config:
163
+ # shorten_keys {
164
+ # "__":"_",
165
+ # "container_":"",
166
+ # "kubernetes_":"k8s_",
167
+ # "labels_":"",
168
+ # }
169
+ shorten_keys, :hash, value_type: :string, default:
170
+ {
171
+ 'kubernetes_':'k8s_',
172
+ 'namespace':'ns',
173
+ 'labels_':'',
174
+ '_name':'',
175
+ '_hash':'',
176
+ 'container_':''
177
+ }
178
+
179
+ ```
131
180
 
132
181
  ## Contributing
133
182
 
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.3.0
data/examples/fluent.conf CHANGED
@@ -8,18 +8,25 @@
8
8
  #
9
9
  # SPDX-License-Identifier: MIT
10
10
 
11
+ # Sample Fluentd config, edit as per your needs.
12
+ # https://github.com/fluent/fluentd-kubernetes-daemonset/tree/master/templates/conf has some good fluentd config examples
11
13
 
14
+ # System level configs
12
15
  <system>
13
16
  log_level info
14
17
  </system>
15
18
 
16
19
  # Prevent fluentd from handling records containing its own logs to handle cycles.
17
- <match fluent.**>
18
- @type null
19
- </match>
20
+ <label @FLUENT_LOG>
21
+ <match fluent.**>
22
+ @type null
23
+ </match>
24
+ </label>
20
25
 
26
+ # Collect all journal logs
21
27
  <source>
22
28
  @type systemd
29
+ @id in_systemd_logs
23
30
  path /run/log/journal
24
31
  # Can filter logs if we want, e.g.
25
32
  #filters [{ "_SYSTEMD_UNIT": "kubelet.service" }]
@@ -33,76 +40,121 @@
33
40
  strip_underscores true
34
41
  </source>
35
42
 
43
+ # Collect all container logs
36
44
  <source>
37
45
  @type tail
46
+ @id in_tail_container_logs
38
47
  path /var/log/containers/*.log
39
48
  # One could exclude certain logs like:
40
- # exclude_path ["/var/log/containers/log-collector*.log"]
49
+ #exclude_path ["/var/log/containers/log-collector*.log"]
41
50
  pos_file /var/log/fluentd-docker.pos
42
- time_format %Y-%m-%dT%H:%M:%S
43
- tag kubernetes.*
44
- format json
45
51
  read_from_head true
52
+ # Set this watcher to false if you have many files to tail
53
+ enable_stat_watcher false
54
+ refresh_interval 5
55
+ tag kubernetes.*
56
+ <parse>
57
+ @type json
58
+ time_key time
59
+ keep_time_key true
60
+ time_format %Y-%m-%dT%H:%M:%S.%NZ
61
+ </parse>
46
62
  </source>
47
63
 
48
-
49
- # Sample rule for services that generate java like stack trace
50
- #<source>
51
- # @type tail
52
- # path /var/log/containers/javaapp**.log
53
- # pos_file /var/log/fluentd-dockerlog.pos
54
- # time_format %b %d %H:%M:%S
55
- # tag kubernetes.*
56
- # format multiline
57
- # format_firstline /\d{4}-\d{1,2}-\d{1,2}/
58
- # format1 /^(?<time>\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}) \[(?<thread>.*)\] (?<level>[^\s]+)(?<message>.*)/
59
- # read_from_head true
60
- #</source>
61
-
62
- # Kubernetes metadata filter that tags additional meta data for each event
63
- <filter kubernetes.var.log.containers.**.log>
64
+ # Kubernetes metadata filter that tags additional meta data for each container event
65
+ <filter kubernetes.**>
64
66
  @type kubernetes_metadata
67
+ @id filter_kube_metadata
68
+ kubernetes_url "#{ENV['FLUENT_FILTER_KUBERNETES_URL'] || 'https://' + ENV.fetch('KUBERNETES_SERVICE_HOST') + ':' + ENV.fetch('KUBERNETES_SERVICE_PORT') + '/api'}"
69
+ verify_ssl "#{ENV['KUBERNETES_VERIFY_SSL'] || true}"
70
+ ca_file "#{ENV['KUBERNETES_CA_FILE']}"
71
+ skip_labels "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_LABELS'] || 'false'}"
72
+ skip_container_metadata "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_CONTAINER_METADATA'] || 'false'}"
73
+ skip_master_url "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_MASTER_URL'] || 'false'}"
74
+ skip_namespace_metadata "#{ENV['FLUENT_KUBERNETES_METADATA_SKIP_NAMESPACE_METADATA'] || 'false'}"
65
75
  </filter>
66
76
 
67
- # If we want to transform events we could use:
68
- #<filter **>
69
- # @type record_transformer
70
- # enable_ruby
71
- # auto_typecast
72
- # <record>
73
- # hostname "#{Socket.gethostname}"
74
- # mykey ${["message"=>record.to_json]}
75
- # </record>
76
- #</filter>
77
+ # Prefix the tag by namespace. This would make it easy to match logs by namespaces
78
+ <match kubernetes.**>
79
+ @type rewrite_tag_filter
80
+ <rule>
81
+ key $.kubernetes.namespace_name
82
+ pattern ^(.+)$
83
+ tag $1.${tag}
84
+ </rule>
85
+ </match>
77
86
 
78
- <match fluent.**>
79
- @type null
87
+ # Collect all kube apiserver audit logs
88
+ <source>
89
+ @type tail
90
+ @id in_tail_kube_audit_logs
91
+ # audit log path of kube-apiserver
92
+ path "/var/log/kube-audit/audit.log"
93
+ pos_file /var/log/kube-audit.pos
94
+ tag kube-audit
95
+ <parse>
96
+ @type json
97
+ time_key timestamp
98
+ keep_time_key false
99
+ time_format %Y-%m-%dT%H:%M:%SZ
100
+ </parse>
101
+ </source>
102
+
103
+ # Loginsight doesn't support ingesting `source` as a field name, get rid of it
104
+ <filter kube-audit>
105
+ @type record_transformer
106
+ @id filter_kube_audit_logs
107
+ enable_ruby
108
+ remove_keys source
109
+ <record>
110
+ log ${record}
111
+ </record>
112
+ </filter>
113
+
114
+ # You can catch and match logs by namespace
115
+ <match my-namespace-one.** my-namespace-two.**>
116
+ @type vmware_loginsight
117
+ @id out_vmw_li_my_namespace_logs
118
+ scheme http
119
+ ssl_verify false
120
+ # Loginsight host: One may use IP address or cname
121
+ #host X.X.X.X
122
+ host MY_LOGINSIGHT_HOST
123
+ port 9000
124
+ agent_id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
125
+ # Keys from log event whose values should be added as log message/text to
126
+ # Loginsight. Note these key/value pairs won't be added as metadata/fields
127
+ log_text_keys ["log","msg","message"]
128
+ # Use this flag if you want to enable http debug logs
129
+ http_conn_debug false
80
130
  </match>
81
131
 
132
+ # Match everything else
82
133
  <match **>
83
134
  @type copy
84
135
  <store>
85
136
  @type vmware_loginsight
137
+ @id out_vmw_li_all_container_logs
86
138
  scheme https
87
139
  ssl_verify true
88
- # Loginsight host: One may use IP address or cname
89
- # host X.X.X.X
90
- host my-loginsight.mycompany.com
91
- port 9000
92
- path api/v1/events/ingest
140
+ # Loginsight host: One may use IP address or cname
141
+ #host X.X.X.X
142
+ host MY_LOGINSIGHT_HOST
143
+ port 9543
93
144
  agent_id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
94
- http_method post
95
- serializer json
96
- rate_limit_msec 0
97
- raise_on_error false
145
+ # Keys from log event whose values should be added as log message/text to
146
+ # Loginsight. Note these key/value pairs won't be added as metadata/fields
98
147
  log_text_keys ["log","msg","message"]
99
- include_tag_key true
100
- tag_key tag
148
+ # Use this flag if you want to enable http debug logs
149
+ http_conn_debug false
101
150
  </store>
102
- # copy plugin supports sending/copying logs to multiple plugins
103
- # One may choose to send them to multiple LIs
104
- # Or one may want send a copy to stdout for debugging
105
- # <store>
106
- # @type stdout
107
- # </store>
151
+ # copy plugin supports sending/copying logs to multiple plugins
152
+ # One may choose to send them to multiple LIs
153
+ # Or one may want send a copy to stdout for debugging
154
+ # Please note, if you use stdout along with LI, catch the logger's log to make
155
+ # sure they're not cyclic
156
+ #<store>
157
+ # @type stdout
158
+ #</store>
108
159
  </match>
160
+
@@ -8,29 +8,41 @@
8
8
  #
9
9
  # SPDX-License-Identifier: MIT
10
10
 
11
- # Builds a debian-based image that contains fluentd, fluent-plugin-vmware-loginsight, fluent-plugin-kubernetes_metadata_filter
12
- # and fluent-plugin-systemd.
11
+
12
+ # Sample Dockerfile to use as log collector
13
+ # Builds a debian-based fluentd image that has fluent-plugin-kubernetes_metadata_filter,
14
+ # fluent-plugin-rewrite-tag-filter, fluent-plugin-systemd and
15
+ # fluent-plugin-vmware-loginsight gem installed.
13
16
  #
14
- # The image is preconfigured with the fluent.conf from the examples dir. For more details see
17
+ # This image will get preconfigured with the fluent.conf if avaialble at the
18
+ # same dir level. For fluentd config example, see
15
19
  # https://github.com/vmware/fluent-plugin-vmware-loginsight/blob/master/examples/fluent.conf
16
- FROM fluent/fluentd:v0.14.15-debian-onbuild
17
- # Above image expects the loginsight plugin vmware_loginsight to be available under ./plugins/vmware_loginsight.rb
18
- # and fluentd config under ./fluent.conf by default
19
20
 
21
+ # This base image is built from https://github.com/fluent/fluentd-kubernetes-daemonset
22
+ FROM fluent/fluentd:v1.11-debian-1
23
+
24
+ # Use root account to use apt
20
25
  USER root
21
26
 
22
- RUN buildDeps="sudo make gcc g++ libc-dev ruby-dev libffi-dev" \
27
+ # You can install your plugins here
28
+ RUN buildDeps="sudo make gcc g++ libc-dev" \
23
29
  && apt-get update \
24
30
  && apt-get install -y --no-install-recommends $buildDeps \
25
31
  && sudo gem install \
26
- fluent-plugin-systemd \
27
- fluent-plugin-kubernetes_metadata_filter \
28
- fluent-plugin-vmware-loginsight \
32
+ fluent-plugin-kubernetes_metadata_filter:2.4.6 \
33
+ fluent-plugin-rewrite-tag-filter:2.3.0 \
34
+ fluent-plugin-systemd:1.0.2 \
35
+ fluent-plugin-vmware-loginsight:0.1.10 \
29
36
  && sudo gem sources --clear-all \
30
37
  && SUDO_FORCE_REMOVE=yes \
31
38
  apt-get purge -y --auto-remove \
32
39
  -o APT::AutoRemove::RecommendsImportant=false \
33
40
  $buildDeps \
34
41
  && rm -rf /var/lib/apt/lists/* \
35
- /home/fluent/.gem/ruby/2.3.0/cache/*.gem \
36
- /home/root/.gem/ruby/2.3.0/cache/*.gem
42
+ && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
43
+
44
+ # You can install the LI plugin using a gem or if you want to test your
45
+ # changes to plugin, you may add the .rb directly under `plugins` dir, then
46
+ # you don't need to install the gem
47
+ COPY plugins /fluentd/plugins/
48
+