fluentd 1.13.0 → 1.14.0.rc

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.yaml +69 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.yaml +38 -0
  4. data/.github/workflows/linux-test.yaml +1 -1
  5. data/.github/workflows/windows-test.yaml +1 -1
  6. data/.gitlab-ci.yml +0 -22
  7. data/CHANGELOG.md +87 -0
  8. data/README.md +2 -2
  9. data/example/v0_12_filter.conf +2 -2
  10. data/fluentd.gemspec +1 -1
  11. data/lib/fluent/command/fluentd.rb +8 -0
  12. data/lib/fluent/command/plugin_generator.rb +15 -5
  13. data/lib/fluent/compat/output.rb +9 -6
  14. data/lib/fluent/config.rb +1 -1
  15. data/lib/fluent/config/section.rb +5 -0
  16. data/lib/fluent/config/types.rb +15 -0
  17. data/lib/fluent/config/v1_parser.rb +3 -2
  18. data/lib/fluent/env.rb +2 -1
  19. data/lib/fluent/event_router.rb +28 -1
  20. data/lib/fluent/oj_options.rb +62 -0
  21. data/lib/fluent/plugin.rb +10 -1
  22. data/lib/fluent/plugin/bare_output.rb +49 -8
  23. data/lib/fluent/plugin/buffer.rb +84 -22
  24. data/lib/fluent/plugin/file_wrapper.rb +22 -0
  25. data/lib/fluent/plugin/filter.rb +35 -1
  26. data/lib/fluent/plugin/formatter.rb +1 -0
  27. data/lib/fluent/plugin/formatter_json.rb +9 -7
  28. data/lib/fluent/plugin/in_monitor_agent.rb +4 -2
  29. data/lib/fluent/plugin/in_syslog.rb +13 -1
  30. data/lib/fluent/plugin/in_tail.rb +45 -4
  31. data/lib/fluent/plugin/in_tail/position_file.rb +20 -18
  32. data/lib/fluent/plugin/input.rb +39 -1
  33. data/lib/fluent/plugin/metrics.rb +119 -0
  34. data/lib/fluent/plugin/metrics_local.rb +96 -0
  35. data/lib/fluent/plugin/multi_output.rb +43 -6
  36. data/lib/fluent/plugin/out_forward.rb +1 -3
  37. data/lib/fluent/plugin/output.rb +74 -33
  38. data/lib/fluent/plugin/parser_json.rb +2 -3
  39. data/lib/fluent/plugin/service_discovery.rb +0 -15
  40. data/lib/fluent/plugin_helper.rb +1 -0
  41. data/lib/fluent/plugin_helper/event_emitter.rb +8 -1
  42. data/lib/fluent/plugin_helper/http_server/router.rb +1 -1
  43. data/lib/fluent/plugin_helper/metrics.rb +129 -0
  44. data/lib/fluent/plugin_helper/server.rb +4 -2
  45. data/lib/fluent/root_agent.rb +6 -0
  46. data/lib/fluent/supervisor.rb +2 -0
  47. data/lib/fluent/system_config.rb +9 -1
  48. data/lib/fluent/test/driver/storage.rb +30 -0
  49. data/lib/fluent/version.rb +1 -1
  50. data/templates/new_gem/lib/fluent/plugin/storage.rb.erb +40 -0
  51. data/templates/new_gem/test/plugin/test_storage.rb.erb +18 -0
  52. data/test/command/test_cat.rb +11 -8
  53. data/test/command/test_plugin_generator.rb +2 -1
  54. data/test/config/test_section.rb +9 -0
  55. data/test/config/test_system_config.rb +6 -0
  56. data/test/config/test_types.rb +7 -0
  57. data/test/plugin/in_tail/test_position_file.rb +48 -8
  58. data/test/plugin/test_bare_output.rb +13 -0
  59. data/test/plugin/test_buffer.rb +8 -2
  60. data/test/plugin/test_file_wrapper.rb +11 -0
  61. data/test/plugin/test_filter.rb +11 -0
  62. data/test/plugin/test_in_forward.rb +59 -83
  63. data/test/plugin/test_in_http.rb +46 -43
  64. data/test/plugin/test_in_monitor_agent.rb +214 -8
  65. data/test/plugin/test_in_syslog.rb +101 -56
  66. data/test/plugin/test_in_tail.rb +149 -48
  67. data/test/plugin/test_in_tcp.rb +45 -32
  68. data/test/plugin/test_in_udp.rb +47 -33
  69. data/test/plugin/test_input.rb +11 -0
  70. data/test/plugin/test_metrics.rb +294 -0
  71. data/test/plugin/test_metrics_local.rb +96 -0
  72. data/test/plugin/test_multi_output.rb +25 -1
  73. data/test/plugin/test_out_forward.rb +103 -89
  74. data/test/plugin/test_out_stream.rb +18 -8
  75. data/test/plugin/test_output.rb +16 -0
  76. data/test/plugin_helper/http_server/test_route.rb +1 -1
  77. data/test/plugin_helper/test_child_process.rb +1 -1
  78. data/test/plugin_helper/test_event_emitter.rb +29 -0
  79. data/test/plugin_helper/test_http_server_helper.rb +33 -26
  80. data/test/plugin_helper/test_metrics.rb +137 -0
  81. data/test/plugin_helper/test_server.rb +137 -138
  82. data/test/plugin_helper/test_socket.rb +16 -9
  83. data/test/test_event_time.rb +2 -2
  84. data/test/test_oj_options.rb +55 -0
  85. data/test/test_plugin_classes.rb +102 -0
  86. data/test/test_root_agent.rb +30 -1
  87. metadata +27 -12
  88. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -40
  89. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20ece94d6aedf52ed5f7bdefedfda93056ef92bbc44a7b7a27c4b4e4660dc5e0
4
- data.tar.gz: 76166c17b6018360db1d192c2a9aa8094c1fea780bc74f715264035f0485d601
3
+ metadata.gz: eab8e56529b8472ac765f6186687659e56081d0d2b21264c05f1e4550965eff6
4
+ data.tar.gz: f64f9a36befc145b9ae862f6eead5588670f5c3252ca821608ce2bc6d8649ed7
5
5
  SHA512:
6
- metadata.gz: 214cbbef726516095e961786462e33b355fd77ecdcd278f5ada3a6f8d02489620ddbf84b9a7a4ba1de27b925f5455dda3c2b90c024bfa573afda05cc453d8e3a
7
- data.tar.gz: 75de8aad92959bcb746be2c225c627e3f6590e2ffba38a91d0d0c540c7752bb2ebacc0623132a8ee613775ce63530a8083070fd008bb54646ecc37e4e2f6ca31
6
+ metadata.gz: 0a3d652b47ce320495511a39c41d6af65825a7455e1a67c7f2c93d7a77c13737acce3c86d79de0c0a95c6a053ba3e4bf3e0dfe19767327f4ea45f489321ef8a6
7
+ data.tar.gz: 0421fa9b68bf1317ff8e44f33908f7603f4298214daa4a0438e36586eca9829b2701144e2148a4a0ccbfeaaf87dd542be4227918eeab523dd3fdbcca0a08d839
@@ -0,0 +1,69 @@
1
+ name: Bug Report
2
+ description: Create a report with a procedure for reproducing the bug
3
+ body:
4
+ - type: markdown
5
+ attributes:
6
+ value: |
7
+ Check [CONTRIBUTING guideline](https://github.com/fluent/fluentd/blob/master/CONTRIBUTING.md) first and here is the list to help us investigate the problem.
8
+ - type: textarea
9
+ id: description
10
+ attributes:
11
+ label: Describe the bug
12
+ description: A clear and concise description of what the bug is
13
+ validations:
14
+ required: true
15
+ - type: textarea
16
+ id: reproduce
17
+ attributes:
18
+ label: To Reproduce
19
+ description: Steps to reproduce the behavior
20
+ validations:
21
+ required: true
22
+ - type: textarea
23
+ id: expected
24
+ attributes:
25
+ label: Expected behavior
26
+ description: A clear and concise description of what you expected to happen
27
+ validations:
28
+ required: true
29
+ - type: textarea
30
+ id: environment
31
+ attributes:
32
+ label: Your Environment
33
+ description: |
34
+ - Fluentd or td-agent version: `fluentd --version` or `td-agent --version`
35
+ - Operating system: `cat /etc/os-release`
36
+ - Kernel version: `uname -r`
37
+
38
+ Tip: If you hit the problem with older fluentd version, try latest version first.
39
+ value: |
40
+ - Fluentd version:
41
+ - TD Agent version:
42
+ - Operating system:
43
+ - Kernel version:
44
+ render: markdown
45
+ validations:
46
+ required: true
47
+ - type: textarea
48
+ id: configuration
49
+ attributes:
50
+ label: Your Configuration
51
+ description: |
52
+ Write your configuration here. Minimum reproducible fluentd.conf is recommended.
53
+ validations:
54
+ required: true
55
+ - type: textarea
56
+ id: logs
57
+ attributes:
58
+ label: Your Error Log
59
+ description: Write your ALL error log here
60
+ render: shell
61
+ validations:
62
+ required: true
63
+ - type: textarea
64
+ id: addtional-context
65
+ attributes:
66
+ label: Additional context
67
+ description: Add any other context about the problem here.
68
+ validations:
69
+ required: false
@@ -0,0 +1,38 @@
1
+ name: Feature request
2
+ description: Suggest an idea for this project
3
+ body:
4
+ - type: markdown
5
+ attributes:
6
+ value: |
7
+ Check [CONTRIBUTING guideline](https://github.com/fluent/fluentd/blob/master/CONTRIBUTING.md) first and here is the list to help us investigate the problem.
8
+ - type: textarea
9
+ id: description
10
+ attributes:
11
+ label: Is your feature request related to a problem? Please describe.
12
+ description: |
13
+ A clear and concise description of what the problem is.
14
+ Ex. I'm always frustrated when [...]
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: solution
19
+ attributes:
20
+ label: Describe the solution you'd like
21
+ description: A clear and concise description of what you want to happen.
22
+ validations:
23
+ required: true
24
+ - type: textarea
25
+ id: alternative
26
+ attributes:
27
+ label: Describe alternatives you've considered
28
+ description: A clear and concise description of any alternative solutions or features you've considered.
29
+ validations:
30
+ required: true
31
+ - type: textarea
32
+ id: addtional-context
33
+ attributes:
34
+ label: Additional context
35
+ description: Add any other context or screenshots about the feature request here.
36
+ validations:
37
+ required: false
38
+
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['3.0', '2.7', '2.6', '2.5']
16
+ ruby-version: ['3.0', '2.7', '2.6']
17
17
  os: [ubuntu-latest]
18
18
  experimental: [false]
19
19
  include:
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['2.7', '2.6', '2.5']
16
+ ruby-version: ['2.7', '2.6']
17
17
  os:
18
18
  - windows-latest
19
19
  experimental: [false]
data/.gitlab-ci.yml CHANGED
@@ -13,16 +13,6 @@ stages:
13
13
  - build
14
14
  - tests
15
15
 
16
- 2-5-8:
17
- image: "ruby:2.5.8"
18
- stage: build
19
- extends: .install-template
20
- script:
21
- - bundle install --jobs=3 --retry=3
22
- cache:
23
- key: "$CI_COMMIT_REF_SLUG 2-5-8"
24
- paths:
25
-
26
16
  2-6-6:
27
17
  image: "ruby:2.6.6"
28
18
  stage: build
@@ -64,18 +54,6 @@ rubyhead:
64
54
  paths:
65
55
  - ./*
66
56
 
67
- 2-5-8-test:
68
- image: "ruby:2.5.8"
69
- stage: tests
70
- allow_failure: true
71
- extends: .test-template
72
- script:
73
- - bundle exec rake test
74
- cache:
75
- key: "$CI_COMMIT_REF_SLUG 2-5-8"
76
- paths:
77
- - ./*
78
-
79
57
  2-6-6-test:
80
58
  image: "ruby:2.6.6"
81
59
  stage: tests
data/CHANGELOG.md CHANGED
@@ -1,3 +1,90 @@
1
+ # v1.13.3
2
+
3
+ ## Release v1.13.3 - 2021/07/27
4
+
5
+ ### Bug fix
6
+
7
+ * in_tail: Care DeletePending state on Windows
8
+ https://github.com/fluent/fluentd/pull/3457
9
+ https://github.com/fluent/fluentd/pull/3460
10
+ * in_tail: Fix some pos_file bugs.
11
+ Avoid deleting pos_file entries unexpectedly when both
12
+ `pos_file_compaction_interval` and `follow_inode` are enabled.
13
+ Use `bytesize` instead of `size` for path length.
14
+ https://github.com/fluent/fluentd/pull/3459
15
+ * in_tail: Fix detecting rotation twice on `follow_inode`.
16
+ https://github.com/fluent/fluentd/pull/3466
17
+
18
+ ### Misc
19
+
20
+ * Remove needless spaces in a sample config file
21
+ https://github.com/fluent/fluentd/pull/3456
22
+
23
+ ### Enhancement
24
+
25
+ # v1.13.2
26
+
27
+ ## Release v1.13.2 - 2021/07/12
28
+
29
+ ### Enhancement
30
+
31
+ * fluent-plugin-generate: Storage plugin was supported.
32
+ https://github.com/fluent/fluentd/pull/3426
33
+ * parser_json: Added support to customize configuration of oj options.
34
+ Use `FLUENT_OJ_OPTION_BIGDECIMAL_LOAD`, `FLUENT_OJ_OPTION_MAX_NESTING`,
35
+ `FLUENT_OJ_OPTION_MODE`, and `FLUENT_OJ_OPTION_USE_TO_JSON` environment
36
+ variable to configure it.
37
+ https://github.com/fluent/fluentd/pull/3315
38
+
39
+ ### Bug fix
40
+
41
+ * binlog_reader: Fixed a crash bug by missing "fluent/env" dependency.
42
+ https://github.com/fluent/fluentd/pull/3443
43
+ * Fixed a crash bug on outputting log at the early stage when parsing
44
+ config file. This is a regression since v1.13.0. If you use invalid
45
+ '@' prefix parameter, remove it as a workaround.
46
+ https://github.com/fluent/fluentd/pull/3451
47
+ * in_tail: Fixed a bug that when rotation is occurred, remaining lines
48
+ will be discarded if the throttling feature is enabled.
49
+ https://github.com/fluent/fluentd/pull/3390
50
+ * fluent-plugin-generate: Fixed a crash bug during gemspec generation.
51
+ It was unexpectedly introduced by #3305, thus this bug was a
52
+ regression since 1.12.3.
53
+ https://github.com/fluent/fluentd/pull/3444
54
+
55
+ ### Misc
56
+
57
+ * Fixed the runtime dependency version of http_parse.rb to 0.7.0.
58
+ It was fixed because false positive detection is occurred frequently
59
+ by security scanning tools.
60
+ https://github.com/fluent/fluentd/pull/3450
61
+
62
+ # v1.13.1
63
+
64
+ ## Release v1.13.1 - 2021/06/25
65
+
66
+ ### Bug fix
67
+
68
+ * out_forward: Fixed a race condition on handshake
69
+ It's caused by using a same unpacker from multiple threads.
70
+ https://github.com/fluent/fluentd/pull/3405
71
+ https://github.com/fluent/fluentd/pull/3406
72
+ * in_tail: Fixed to remove too much verbose debugging logs
73
+ It was unexpectedly introduced by #3185 log throttling feature.
74
+ https://github.com/fluent/fluentd/pull/3418
75
+ * Fixed not to echo back the provides path as is on a 404 error
76
+ There was a potential cross-site scripting vector even though
77
+ it is quite difficult to exploit.
78
+ https://github.com/fluent/fluentd/pull/3427
79
+
80
+ ### Misc
81
+
82
+ * Pretty print for Fluent::Config::Section has been supported
83
+ for debugging
84
+ https://github.com/fluent/fluentd/pull/3398
85
+ * CI: Dropped to run CI for Ruby 2.5
86
+ https://github.com/fluent/fluentd/pull/3412
87
+
1
88
  # v1.13
2
89
 
3
90
  ## Release v1.13.0 - 2021/05/29
data/README.md CHANGED
@@ -25,9 +25,9 @@ An event consists of *tag*, *time* and *record*. Tag is a string separated with
25
25
 
26
26
  Use Case | Description | Diagram
27
27
  -------- | ------------|:---------:
28
- Centralizing Apache/Nginx Server Logs | Fluentd can be used to tail access/error logs and transport them reliably to remote systems. | <img src="https://www.fluentd.org/assets/img/recipes/elasticsearch-s3-fluentd.png" height="150"/>
28
+ Centralizing Apache/Nginx Server Logs | Fluentd can be used to tail access/error logs and transport them reliably to remote systems. | <img src="https://www.fluentd.org/images/recipes/elasticsearch-s3-fluentd.png" height="150"/>
29
29
  Syslog Alerting | Fluentd can "grep" for events and send out alerts. | <img src="https://www.fluentd.org/images/syslog-fluentd-alert.png" height="100"/>
30
- Mobile/Web Application Logging | Fluentd can function as middleware to enable asynchronous, scalable logging for user action events. | <img src="https://www.fluentd.org/assets/img/datasources/asynchronous_logging.png" height="150"/>
30
+ Mobile/Web Application Logging | Fluentd can function as middleware to enable asynchronous, scalable logging for user action events. | <img src="https://www.fluentd.org/images/datasources/asynchronous_logging.png" height="150"/>
31
31
 
32
32
  ## Quick Start
33
33
 
@@ -52,10 +52,10 @@
52
52
  </match>
53
53
 
54
54
  # Composing two filters. For all events with the tag foo.bar,
55
- #
55
+ #
56
56
  # 1. The first filter filters out all events that has the field "hello"
57
57
  # 2. Then, for those events, we downcase the value of the "name" field.
58
- #
58
+ #
59
59
  # - {"name":"SADA", "hello":100} gets filtered out
60
60
  # - {"name":"SADA"} becomes {"name":"sada"}
61
61
  # - {"last_name":"FURUHASHI"} throws an error because it has no field called "name"
data/fluentd.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_runtime_dependency("yajl-ruby", ["~> 1.0"])
24
24
  gem.add_runtime_dependency("cool.io", [">= 1.4.5", "< 2.0.0"])
25
25
  gem.add_runtime_dependency("serverengine", [">= 2.2.2", "< 3.0.0"])
26
- gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.7.0"])
26
+ gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.8.0"])
27
27
  gem.add_runtime_dependency("sigdump", ["~> 0.2.2"])
28
28
  gem.add_runtime_dependency("tzinfo", [">= 1.0", "< 3.0"])
29
29
  gem.add_runtime_dependency("tzinfo-data", ["~> 1.0"])
@@ -134,6 +134,14 @@ op.on('--strict-config-value', "Parse config values strictly", TrueClass) {|b|
134
134
  opts[:strict_config_value] = b
135
135
  }
136
136
 
137
+ op.on('--enable-input-metrics', "Enable input plugin metrics on fluentd", TrueClass) {|b|
138
+ opts[:enable_input_metrics] = b
139
+ }
140
+
141
+ op.on('--enable-size-metrics', "Enable plugin record size metrics on fluentd", TrueClass) {|b|
142
+ opts[:enable_size_metrics] = b
143
+ }
144
+
137
145
  op.on('-v', '--verbose', "increase verbose level (-v: debug, -vv: trace)", TrueClass) {|b|
138
146
  if b
139
147
  opts[:log_level] = [opts[:log_level] - 1, Fluent::Log::LEVEL_TRACE].max
@@ -27,7 +27,7 @@ class FluentPluginGenerator
27
27
  attr_reader :type, :name
28
28
  attr_reader :license_name
29
29
 
30
- SUPPORTED_TYPES = ["input", "output", "filter", "parser", "formatter"]
30
+ SUPPORTED_TYPES = ["input", "output", "filter", "parser", "formatter", "storage"]
31
31
 
32
32
  def initialize(argv = ARGV)
33
33
  @argv = argv
@@ -164,8 +164,13 @@ BANNER
164
164
  end
165
165
 
166
166
  def locked_gem_version(gem_name)
167
- d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
168
- d.locked_gems.dependencies[gem_name].requirement.requirements.first.last.version
167
+ if File.exist?(lock_file_path)
168
+ d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
169
+ d.locked_gems.dependencies[gem_name].requirement.requirements.first.last.version
170
+ else
171
+ # fallback even though Fluentd is installed without bundler
172
+ Gem::Specification.find_by_name(gem_name).version.version
173
+ end
169
174
  end
170
175
 
171
176
  def rake_version
@@ -177,8 +182,13 @@ BANNER
177
182
  end
178
183
 
179
184
  def bundler_version
180
- d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
181
- d.locked_gems.bundler_version.version
185
+ if File.exist?(lock_file_path)
186
+ d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
187
+ d.locked_gems.bundler_version.version
188
+ else
189
+ # fallback even though Fluentd is installed without bundler
190
+ Gem::Specification.find_by_name("bundler").version.version
191
+ end
182
192
  end
183
193
 
184
194
  def class_name
@@ -310,7 +310,7 @@ module Fluent
310
310
  # original implementation of v0.12 BufferedOutput
311
311
  def emit(tag, es, chain, key="")
312
312
  # this method will not be used except for the case that plugin calls super
313
- @emit_count += 1
313
+ @emit_count_metrics.inc
314
314
  data = format_stream(tag, es)
315
315
  if @buffer.emit(key, data, chain)
316
316
  submit_flush
@@ -337,14 +337,14 @@ module Fluent
337
337
  # because v0.12 BufferedOutput may overrides #format_stream, but original #handle_stream_simple method doesn't consider about it
338
338
  def handle_stream_simple(tag, es, enqueue: false)
339
339
  if @overrides_emit
340
- current_emit_count = @emit_count
340
+ current_emit_count = @emit_count_metrics.get
341
341
  size = es.size
342
342
  key = data = nil
343
343
  begin
344
344
  emit(tag, es, NULL_OUTPUT_CHAIN)
345
345
  key, data = self.last_emit_via_buffer
346
346
  ensure
347
- @emit_count = current_emit_count
347
+ @emit_count_metrics.set(current_emit_count)
348
348
  self.last_emit_via_buffer = nil
349
349
  end
350
350
  # on-the-fly key assignment can be done, and it's not configurable if Plugin#emit does it dynamically
@@ -352,7 +352,8 @@ module Fluent
352
352
  write_guard do
353
353
  @buffer.write({meta => data}, format: ->(_data){ _data }, size: ->(){ size }, enqueue: enqueue)
354
354
  end
355
- @counter_mutex.synchronize{ @emit_records += size }
355
+ @emit_records_metrics.add(es.size)
356
+ @emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics
356
357
  return [meta]
357
358
  end
358
359
 
@@ -363,7 +364,8 @@ module Fluent
363
364
  write_guard do
364
365
  @buffer.write({meta => bulk}, format: ->(_data){ _data }, size: ->(){ size }, enqueue: enqueue)
365
366
  end
366
- @counter_mutex.synchronize{ @emit_records += size }
367
+ @emit_records_metrics.add(es.size)
368
+ @emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics
367
369
  return [meta]
368
370
  end
369
371
 
@@ -373,7 +375,8 @@ module Fluent
373
375
  write_guard do
374
376
  @buffer.write({meta => data}, enqueue: enqueue)
375
377
  end
376
- @counter_mutex.synchronize{ @emit_records += size }
378
+ @emit_records_metrics.add(es.size)
379
+ @emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics
377
380
  [meta]
378
381
  end
379
382
 
data/lib/fluent/config.rb CHANGED
@@ -62,7 +62,7 @@ module Fluent
62
62
  Parser.parse(str, fname, basepath)
63
63
  when :ruby
64
64
  require 'fluent/config/dsl'
65
- $log.warn("Ruby DSL configuration format is deprecated. Please use original configuration format. https://docs.fluentd.org/configuration/config-file")
65
+ $log.warn("Ruby DSL configuration format is deprecated. Please use original configuration format. https://docs.fluentd.org/configuration/config-file") if $log
66
66
  Config::DSL::Parser.parse(str, File.join(basepath, fname))
67
67
  else
68
68
  raise "[BUG] unknown configuration parser specification:'#{parser}'"
@@ -50,6 +50,11 @@ module Fluent
50
50
  "<Fluent::Config::Section #{@params.to_json}>"
51
51
  end
52
52
 
53
+ # Used by PP and Pry
54
+ def pretty_print(q)
55
+ q.text(inspect)
56
+ end
57
+
53
58
  def nil?
54
59
  false
55
60
  end
@@ -20,6 +20,10 @@ require 'fluent/config/error'
20
20
 
21
21
  module Fluent
22
22
  module Config
23
+ def self.reformatted_value(type, val, opts = {}, name = nil)
24
+ REFORMAT_VALUE.call(type, val, opts, name)
25
+ end
26
+
23
27
  def self.size_value(str, opts = {}, name = nil)
24
28
  return nil if str.nil?
25
29
 
@@ -104,6 +108,16 @@ module Fluent
104
108
  Config.string_value(val, opts, name)
105
109
  }
106
110
 
111
+ def self.symbol_value(val, opts = {}, name = nil)
112
+ return nil if val.nil? || val.empty?
113
+
114
+ val.delete_prefix(":").to_sym
115
+ end
116
+
117
+ SYMBOL_TYPE = Proc.new { |val, opts = {}, name = nil|
118
+ Config.symbol_value(val, opts, name)
119
+ }
120
+
107
121
  def self.enum_value(val, opts = {}, name = nil)
108
122
  return nil if val.nil?
109
123
 
@@ -176,6 +190,7 @@ module Fluent
176
190
  when :bool then Config.bool_value(value, opts, name)
177
191
  when :time then Config.time_value(value, opts, name)
178
192
  when :regexp then Config.regexp_value(value, opts, name)
193
+ when :symbol then Config.symbol_value(value, opts, name)
179
194
  else
180
195
  raise "unknown type in REFORMAT: #{type}"
181
196
  end