fluent-plugin-vmware-loginsight 1.0.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7e7d17226c807f4fffdd8723c9f260730af5de29334a1b10271993b21709185
4
- data.tar.gz: 768c2724b2b84ac8ae8c1e4473dbe850c37a87102aaed95d6c52fc4f06f9a0df
3
+ metadata.gz: 3d297a36377a2b0ccc771968c32a452144c902c768e4e37005b78346726b884f
4
+ data.tar.gz: 87f18756a8f44bfab712f683039243847120305ddb0dfbf6c09b8d3ee5159c43
5
5
  SHA512:
6
- metadata.gz: 912e7dfa34b63dc9da92635603e88fea94d340ce8fb9aef99827bfd6896690a89533fe523416c2eafd34da2470016b13d23c290c74d93dc05fdb320beec78b55
7
- data.tar.gz: 5998ef3e2869d13cd30dc934347b3dad6ebe2337de5678a7fb12f641b15a5b0a5a60daaa8bd9b5490ecdf58e5fb5f3529dd313ea2606126aaae8456dad023ffb
6
+ metadata.gz: 9262a17913a26fccd037c59a48656c815a3cffb4e49a531394514e7b7559d2bf510b393e36ce56402e6a53e0088ecb07c1aa700603e1d595c924d54250e11415
7
+ data.tar.gz: ad6d6702e6676afab117122ba4fdbede96ac568c08f69bbd97e294c6af6053e79cf7d328dfae0ca9e7fe89fd23879400e78a243be1bbef02b7f66b500f5daa8d
@@ -26,13 +26,13 @@ jobs:
26
26
  GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
27
27
  OWNER: ${{ github.repository_owner }}
28
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}}"
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 CHANGED
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
 
3
- ## v1.0.0 - April 19, 2021
3
+ ## v1.3.1 - Nov 01, 2022
4
+
5
+ * Based Photon image has been updated to photon:4.0-20221029
6
+
7
+ ## v1.3.0 - July 29, 2022
8
+
9
+ * Added buffering support which allows sending out logs in chunks rather than one by one
10
+
11
+ ## v1.0.0 - April 20, 2021
4
12
 
5
13
  * Update plugin structure to use Fluentd 1.x syntax
6
14
 
data/Dockerfile ADDED
@@ -0,0 +1,72 @@
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-20221029
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 build-essential" \
25
+ #
26
+ # Distro sync and install build dependencies
27
+ && tdnf distro-sync --refresh -y \
28
+ && tdnf remove -y toybox \
29
+ && tdnf install -y $buildDeps ruby \
30
+ #
31
+ # These are not required but are used if available
32
+ && gem install oj -v 3.3.10 \
33
+ && gem install json -v 2.2.0 \
34
+ && gem install async-http -v 0.46.3 \
35
+ #
36
+ # Install fluentd
37
+ && gem install --norc --no-document fluentd \
38
+ && gem install --norc --no-document fluent-plugin-systemd \
39
+ && gem install --norc --no-document i18n \
40
+ && gem install --norc --no-document fluent-plugin-concat \
41
+ && gem install --norc --no-document fluent-plugin-remote_syslog \
42
+ && gem install --norc --no-document fluent-plugin-docker_metadata_filter \
43
+ && gem install --norc --no-document fluent-plugin-detect-exceptions \
44
+ && gem install --norc --no-document fluent-plugin-multi-format-parser \
45
+ && gem install --norc --no-document fluent-plugin-kubernetes_metadata_filter \
46
+ #
47
+ # Install Log Insight plugin
48
+ && gem install --norc --no-document -v 1.3.0 fluent-plugin-vmware-loginsight \
49
+ #
50
+ # Install jemalloc 5.3.0
51
+ && curl -L --output /tmp/jemalloc-5.3.0.tar.bz2 https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 \
52
+ && tar -C /tmp/ -xjvf /tmp/jemalloc-5.3.0.tar.bz2 \
53
+ && cd /tmp/jemalloc-5.3.0 \
54
+ && ./configure && make \
55
+ && mv lib/libjemalloc.so.2 /usr/lib \
56
+ && cd / \
57
+ && rm -rf /tmp/jemalloc-5.3.0* \
58
+ && tdnf remove -y $buildDeps \
59
+ && tdnf clean all \
60
+ && gem sources --clear-all \
61
+ && gem cleanup
62
+
63
+ # Create default fluent.conf
64
+ RUN fluentd --setup /etc/fluentd
65
+
66
+ # Make sure fluentd picks jemalloc
67
+ ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"
68
+
69
+ # Standard fluentd ports
70
+ EXPOSE 24224 5140
71
+
72
+ ENTRYPOINT ["fluentd", "-c", "/etc/fluentd/fluent.conf"]
data/README.md CHANGED
@@ -43,6 +43,8 @@ $ bundle
43
43
  enable_stat_watcher false
44
44
  refresh_interval 5
45
45
  tag kubernetes.*
46
+ # Open below line if you need have filename as tag field (now without prefix kubernetes.)
47
+ # path_key tag
46
48
  <parse>
47
49
  @type json
48
50
  time_key time
@@ -137,12 +139,6 @@ rate_limit_msec, :integer, :default => 0
137
139
  # Raise errors that were rescued during HTTP requests?
138
140
  raise_on_error, :bool, :default => false :: Valid Value: true | false
139
141
 
140
- # Include tag key as log event?
141
- include_tag_key, :bool, :default => true :: Valid Value: true | false
142
-
143
- # Metadata key that identifies Fluentd tags
144
- tag_key, :string, :default => 'tag'
145
-
146
142
  # Keys from log event whose values should be added as log message/text to loginsight.
147
143
  # These key/value pairs won't expanded/flattened and won't be added as metadata/fields.
148
144
  log_text_keys, :array, :default => ["log", "message", "msg"] :: Valid Value: Array of strings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.3.1
@@ -15,8 +15,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
15
15
  Gem::Specification.new do |spec|
16
16
  spec.name = "fluent-plugin-vmware-loginsight"
17
17
  spec.version = File.read("VERSION").strip
18
- spec.authors = ["Vishal Mohite", "Chris Todd"]
19
- spec.email = ["vmohite@vmware.com", "toddc@vmware.com"]
18
+ spec.authors = ["Vishal Mohite", "Chris Todd", "Samvel Israelyan"]
19
+ spec.email = ["vmohite@vmware.com", "toddc@vmware.com", "sisraelyan@vmware.com"]
20
20
 
21
21
  spec.summary = %q{Fluend output plugin to forward logs to VMware Log Insight}
22
22
  spec.description = spec.summary
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.test_files = test_files
32
32
  spec.require_paths = ["lib"]
33
33
 
34
- spec.add_development_dependency "bundler", "~> 1.14"
34
+ spec.add_development_dependency "bundler", ">= 2.1.0"
35
35
  spec.add_development_dependency "rake", "~> 12.0"
36
36
  spec.add_development_dependency "test-unit", "~> 3.0"
37
37
  spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"]
@@ -49,6 +49,7 @@ module Fluent::Plugin
49
49
  config_param :request_retries, :integer, :default => 3
50
50
  config_param :request_timeout, :time, :default => 5
51
51
  config_param :http_conn_debug, :bool, :default => false
52
+ # in bytes
52
53
  config_param :max_batch_size, :integer, :default => 512000
53
54
 
54
55
  # Simple rate limiting: ignore any records within `rate_limit_msec`
@@ -56,10 +57,6 @@ module Fluent::Plugin
56
57
  config_param :rate_limit_msec, :integer, :default => 0
57
58
  # Raise errors that were rescued during HTTP requests?
58
59
  config_param :raise_on_error, :bool, :default => false
59
- ### Additional Params
60
- config_param :include_tag_key, :bool, :default => true
61
- # Metadata key that identifies Fluentd tags
62
- config_param :tag_key, :string, :default => 'tag'
63
60
  # Keys from log event whose values should be added as log message/text
64
61
  # to loginsight. Note these key/value pairs won't be added as metadata/fields
65
62
  config_param :log_text_keys, :array, default: ["log", "message", "msg"], value_type: :string
@@ -92,6 +89,12 @@ module Fluent::Plugin
92
89
  'container_':''
93
90
  }
94
91
 
92
+ config_section :buffer do
93
+ config_set_default :@type, "memory"
94
+ config_set_default :chunk_keys, []
95
+ config_set_default :timekey_use_utc, true
96
+ end
97
+
95
98
  def configure(conf)
96
99
  super
97
100
 
@@ -134,15 +137,13 @@ module Fluent::Plugin
134
137
  key
135
138
  end
136
139
 
137
- def create_loginsight_event(tag, time, record)
140
+ def create_loginsight_event(time, record)
138
141
  flattened_records = {}
139
142
  if @flatten_hashes
140
143
  flattened_records = flatten_record(record, [])
141
144
  else
142
145
  flattened_records = record
143
146
  end
144
- # tag can be immutable in some cases, use a copy.
145
- flattened_records[@tag_key] = tag.dup if @include_tag_key
146
147
  fields = []
147
148
  keys = []
148
149
  log = ''
@@ -218,15 +219,6 @@ module Fluent::Plugin
218
219
  ret
219
220
  end
220
221
 
221
- def create_request(tag, time, record)
222
- url = format_url()
223
- uri = URI.parse(url)
224
- req = Net::HTTP.const_get(@http_method.to_s.capitalize).new(uri.path)
225
- set_body(req, tag, time, record)
226
- set_header(req)
227
- return req, uri
228
- end
229
-
230
222
  def send_request(req, uri)
231
223
  is_rate_limited = (@rate_limit_msec != 0 and not @last_request_time.nil?)
232
224
  if is_rate_limited and ((Time.now.to_f - @last_request_time) * 1000.0 < @rate_limit_msec)
@@ -290,13 +282,13 @@ module Fluent::Plugin
290
282
  send_request(req, uri)
291
283
  end
292
284
 
293
- def handle_records(tag, es)
285
+ def handle_records(chunk)
294
286
  url = format_url()
295
287
  uri = URI.parse(url)
296
288
  events = []
297
289
  count = 0
298
- es.each do |time, record|
299
- new_event = create_loginsight_event(tag, time, record)
290
+ chunk.each do |time, record|
291
+ new_event = create_loginsight_event(time, record)
300
292
  new_event_size = new_event.to_json.size
301
293
  if new_event_size > @max_batch_size
302
294
  $log.warn "dropping event larger than max_batch_size: #{new_event.to_json[1..1024]}"
@@ -315,8 +307,9 @@ module Fluent::Plugin
315
307
  end
316
308
  end
317
309
 
318
- def process(tag, es)
319
- handle_records(tag, es)
310
+ # Sync Buffered Output
311
+ def write(chunk)
312
+ handle_records(chunk)
320
313
  end
321
314
  end
322
315
  end
metadata CHANGED
@@ -1,30 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-vmware-loginsight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vishal Mohite
8
8
  - Chris Todd
9
- autorequire:
9
+ - Samvel Israelyan
10
+ autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2021-04-20 00:00:00.000000000 Z
13
+ date: 2022-11-05 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: bundler
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
- - - "~>"
19
+ - - ">="
19
20
  - !ruby/object:Gem::Version
20
- version: '1.14'
21
+ version: 2.1.0
21
22
  type: :development
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
- - - "~>"
26
+ - - ">="
26
27
  - !ruby/object:Gem::Version
27
- version: '1.14'
28
+ version: 2.1.0
28
29
  - !ruby/object:Gem::Dependency
29
30
  name: rake
30
31
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +78,7 @@ description: Fluend output plugin to forward logs to VMware Log Insight
77
78
  email:
78
79
  - vmohite@vmware.com
79
80
  - toddc@vmware.com
81
+ - sisraelyan@vmware.com
80
82
  executables: []
81
83
  extensions: []
82
84
  extra_rdoc_files: []
@@ -85,6 +87,7 @@ files:
85
87
  - ".gitignore"
86
88
  - CHANGELOG.md
87
89
  - CONTRIBUTING.md
90
+ - Dockerfile
88
91
  - Gemfile
89
92
  - LICENSE
90
93
  - README.md
@@ -103,7 +106,7 @@ homepage: https://github.com/vmware/fluent-plugin-vmware-loginsight
103
106
  licenses:
104
107
  - MIT
105
108
  metadata: {}
106
- post_install_message:
109
+ post_install_message:
107
110
  rdoc_options: []
108
111
  require_paths:
109
112
  - lib
@@ -118,8 +121,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
121
  - !ruby/object:Gem::Version
119
122
  version: '0'
120
123
  requirements: []
121
- rubygems_version: 3.2.3
122
- signing_key:
124
+ rubyforge_project:
125
+ rubygems_version: 2.7.6
126
+ signing_key:
123
127
  specification_version: 4
124
128
  summary: Fluend output plugin to forward logs to VMware Log Insight
125
129
  test_files: