fluentd 1.12.1 → 1.12.4

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/.deepsource.toml +13 -0
  3. data/.github/ISSUE_TEMPLATE/config.yml +2 -2
  4. data/.github/workflows/linux-test.yaml +36 -0
  5. data/.github/workflows/{build.yaml → macos-test.yaml} +8 -7
  6. data/.github/workflows/windows-test.yaml +35 -0
  7. data/.gitlab-ci.yml +41 -19
  8. data/CHANGELOG.md +95 -0
  9. data/MAINTAINERS.md +5 -2
  10. data/README.md +5 -2
  11. data/fluentd.gemspec +4 -2
  12. data/lib/fluent/command/bundler_injection.rb +1 -1
  13. data/lib/fluent/command/cat.rb +0 -1
  14. data/lib/fluent/command/plugin_config_formatter.rb +2 -1
  15. data/lib/fluent/command/plugin_generator.rb +31 -1
  16. data/lib/fluent/compat/parser.rb +2 -2
  17. data/lib/fluent/config/section.rb +1 -1
  18. data/lib/fluent/config/types.rb +2 -2
  19. data/lib/fluent/event.rb +3 -13
  20. data/lib/fluent/load.rb +0 -1
  21. data/lib/fluent/plugin/file_wrapper.rb +39 -3
  22. data/lib/fluent/plugin/formatter_ltsv.rb +2 -2
  23. data/lib/fluent/plugin/in_http.rb +1 -1
  24. data/lib/fluent/plugin/in_monitor_agent.rb +1 -1
  25. data/lib/fluent/plugin/in_tail/position_file.rb +15 -1
  26. data/lib/fluent/plugin/in_tail.rb +35 -15
  27. data/lib/fluent/plugin/out_copy.rb +18 -5
  28. data/lib/fluent/plugin/out_exec_filter.rb +3 -3
  29. data/lib/fluent/plugin/out_forward.rb +61 -28
  30. data/lib/fluent/plugin/output.rb +11 -9
  31. data/lib/fluent/plugin/parser_csv.rb +2 -2
  32. data/lib/fluent/plugin/parser_syslog.rb +2 -2
  33. data/lib/fluent/plugin/storage_local.rb +4 -4
  34. data/lib/fluent/plugin_helper/server.rb +4 -2
  35. data/lib/fluent/plugin_helper/socket_option.rb +2 -2
  36. data/lib/fluent/supervisor.rb +1 -1
  37. data/lib/fluent/time.rb +57 -1
  38. data/lib/fluent/version.rb +1 -1
  39. data/templates/new_gem/fluent-plugin.gemspec.erb +3 -3
  40. data/test/command/test_fluentd.rb +8 -0
  41. data/test/config/test_configurable.rb +1 -1
  42. data/test/plugin/in_tail/test_position_file.rb +58 -4
  43. data/test/plugin/test_file_wrapper.rb +105 -0
  44. data/test/plugin/test_in_exec.rb +1 -1
  45. data/test/plugin/test_in_tail.rb +87 -26
  46. data/test/plugin/test_out_copy.rb +87 -0
  47. data/test/plugin/test_out_forward.rb +94 -6
  48. data/test/plugin/test_out_http.rb +1 -1
  49. data/test/plugin/test_output.rb +15 -3
  50. data/test/plugin/test_output_as_buffered_backup.rb +2 -0
  51. data/test/plugin/test_parser_csv.rb +14 -0
  52. data/test/plugin/test_parser_syslog.rb +14 -0
  53. data/test/plugin_helper/service_discovery/test_manager.rb +1 -1
  54. data/test/plugin_helper/test_child_process.rb +5 -2
  55. data/test/plugin_helper/test_http_server_helper.rb +1 -1
  56. data/test/plugin_helper/test_server.rb +8 -2
  57. data/test/test_event.rb +16 -0
  58. data/test/test_formatter.rb +30 -0
  59. data/test/test_output.rb +2 -2
  60. data/test/test_time_parser.rb +109 -0
  61. metadata +31 -9
  62. data/.travis.yml +0 -77
  63. data/appveyor.yml +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04be4b818522c222348ba309bccd34f03d0aa79bfc2fbd21f2ce738677d7a5e5
4
- data.tar.gz: '078ce4c3003b74be7356367ff81d96d910a5df322ebe2319d96120cb1e2898b3'
3
+ metadata.gz: 18ac12d4a5dd93864521dae3a8a7db37fbe3bcd385f80a394bd6ddb34ffa6541
4
+ data.tar.gz: 105bc856fdf9863e414da2147d53a849d418f6ba6810888eab023d28e2097035
5
5
  SHA512:
6
- metadata.gz: 77298246f6064ddf342765c37efb269236025566b33828cac9c88d69b6dabbbd2881c28ddae699d4620817a44a77310e15c4ac191a0ad51b6aeab51eb7442961
7
- data.tar.gz: 318668fa9fde451292fd3b4284fc513124e6aa29218388a8a7cdfaaeb3943b3d3c4ffa45041cb0b2487da6573a9818f225c81b8769b7c025342bc5a6b5b05b53
6
+ metadata.gz: 16d72d0914ee5eb42ecb9e3957e791ddab88e1a32ed810785615470a0539eb01f0b91085167edac16937ec72b9352582ace8db3fc0adc06b64c3842111b16e3e
7
+ data.tar.gz: e928fc8ccaf35460e24b2157d95c3b2a076574fdd90801be94ff39fc86d92770f948425317aa8c1f192d826e190ce5e0abd5770bef922a8ed5e42c0494ca2c38
data/.deepsource.toml ADDED
@@ -0,0 +1,13 @@
1
+ version = 1
2
+
3
+ test_patterns = ["test/**/test_*.rb"]
4
+
5
+ exclude_patterns = [
6
+ "bin/**",
7
+ "docs/**",
8
+ "example/**"
9
+ ]
10
+
11
+ [[analyzers]]
12
+ name = "ruby"
13
+ enabled = true
@@ -1,5 +1,5 @@
1
1
  blank_issues_enabled: false
2
2
  contact_links:
3
3
  - name: Ask a Question
4
- url: https://groups.google.com/forum/#!forum/fluentd
5
- about: I have questions about Fluentd and plugins. Please ask and answer questions here
4
+ url: https://discuss.fluentd.org/
5
+ about: I have questions about Fluentd and plugins. Please ask and answer questions at https://discuss.fluentd.org/.
@@ -0,0 +1,36 @@
1
+ name: Testing on Ubuntu
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ continue-on-error: ${{ matrix.experimental }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ ruby-version: ['3.0', '2.7', '2.6', '2.5']
17
+ os: [ubuntu-latest]
18
+ experimental: [false]
19
+ include:
20
+ - ruby-version: head
21
+ os: ubuntu-latest
22
+ experimental: true
23
+
24
+ name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby-version }}
31
+ - name: Install addons
32
+ run: sudo apt-get install libgmp3-dev libcap-ng-dev
33
+ - name: Install dependencies
34
+ run: bundle install
35
+ - name: Run tests
36
+ run: bundle exec rake test
@@ -1,4 +1,4 @@
1
- name: build
1
+ name: Testing on macOS
2
2
 
3
3
  on:
4
4
  push:
@@ -8,22 +8,23 @@ on:
8
8
 
9
9
  jobs:
10
10
  test:
11
- runs-on: ubuntu-latest
12
-
11
+ runs-on: ${{ matrix.os }}
12
+ continue-on-error: ${{ matrix.experimental }}
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: [2.7, 2.6, 2.5]
16
+ ruby-version: ['head', '2.7']
17
+ os: [macos-latest]
18
+ experimental: [true]
17
19
 
20
+ name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
18
21
  steps:
19
22
  - uses: actions/checkout@v2
20
23
  - name: Set up Ruby
21
24
  uses: ruby/setup-ruby@v1
22
25
  with:
23
26
  ruby-version: ${{ matrix.ruby-version }}
24
- - name: Install addons
25
- run: sudo apt-get install libgmp3-dev libcap-ng-dev
26
27
  - name: Install dependencies
27
28
  run: bundle install
28
29
  - name: Run tests
29
- run: bundle exec rake test TESTOPTS=-v
30
+ run: bundle exec rake test
@@ -0,0 +1,35 @@
1
+ name: Testing on Windows
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ continue-on-error: ${{ matrix.experimental }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ ruby-version: ['2.7', '2.6', '2.5']
17
+ os:
18
+ - windows-latest
19
+ experimental: [false]
20
+ include:
21
+ - ruby-version: '3.0'
22
+ os: windows-latest
23
+ experimental: true
24
+
25
+ name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - name: Set up Ruby
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby-version }}
32
+ - name: Install dependencies
33
+ run: ridk exec bundle install
34
+ - name: Run tests
35
+ run: bundle exec rake test TESTOPTS=-v
data/.gitlab-ci.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  .install-template:
2
2
  before_script:
3
- - gem update --system=2.7.8
3
+ - gem update --system
4
4
  - ruby -v
5
5
 
6
6
  .test-template:
@@ -13,34 +13,44 @@ stages:
13
13
  - build
14
14
  - tests
15
15
 
16
- 2-4-5:
17
- image: "ruby:2.4.5"
16
+ 2-5-8:
17
+ image: "ruby:2.5.8"
18
18
  stage: build
19
19
  extends: .install-template
20
20
  script:
21
21
  - bundle install --jobs=3 --retry=3
22
22
  cache:
23
- key: "$CI_COMMIT_REF_SLUG 2-4-5"
23
+ key: "$CI_COMMIT_REF_SLUG 2-5-8"
24
24
  paths:
25
25
 
26
- 2-5-5:
27
- image: "ruby:2.5.5"
26
+ 2-6-6:
27
+ image: "ruby:2.6.6"
28
28
  stage: build
29
29
  extends: .install-template
30
30
  script:
31
31
  - bundle install --jobs=3 --retry=3
32
32
  cache:
33
- key: "$CI_COMMIT_REF_SLUG 2-5-5"
33
+ key: "$CI_COMMIT_REF_SLUG 2-6-6"
34
34
  paths:
35
35
 
36
- 2-6-3:
37
- image: "ruby:2.6.3"
36
+ 2-7-2:
37
+ image: "ruby:2.7.2"
38
38
  stage: build
39
39
  extends: .install-template
40
40
  script:
41
41
  - bundle install --jobs=3 --retry=3
42
42
  cache:
43
- key: "$CI_COMMIT_REF_SLUG 2-6-3"
43
+ key: "$CI_COMMIT_REF_SLUG 2-7-2"
44
+ paths:
45
+
46
+ 3-0-0:
47
+ image: "ruby:3.0.0"
48
+ stage: build
49
+ extends: .install-template
50
+ script:
51
+ - bundle install --jobs=3 --retry=3
52
+ cache:
53
+ key: "$CI_COMMIT_REF_SLUG 3-0-0"
44
54
  paths:
45
55
 
46
56
  rubyhead:
@@ -54,39 +64,51 @@ rubyhead:
54
64
  paths:
55
65
  - ./*
56
66
 
57
- 2-4-5-test:
58
- image: "ruby:2.4.5"
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
+ 2-6-6-test:
80
+ image: "ruby:2.6.6"
59
81
  stage: tests
60
82
  allow_failure: true
61
83
  extends: .test-template
62
84
  script:
63
85
  - bundle exec rake test
64
86
  cache:
65
- key: "$CI_COMMIT_REF_SLUG 2-4-5"
87
+ key: "$CI_COMMIT_REF_SLUG 2-6-6"
66
88
  paths:
67
89
  - ./*
68
90
 
69
- 2-5-5-test:
70
- image: "ruby:2.5.5"
91
+ 2-7-2-test:
92
+ image: "ruby:2.7.2"
71
93
  stage: tests
72
94
  allow_failure: true
73
95
  extends: .test-template
74
96
  script:
75
97
  - bundle exec rake test
76
98
  cache:
77
- key: "$CI_COMMIT_REF_SLUG 2-5-5"
99
+ key: "$CI_COMMIT_REF_SLUG 2-7-2"
78
100
  paths:
79
101
  - ./*
80
102
 
81
- 2-6-3-test:
82
- image: "ruby:2.6.3"
103
+ 3-0-0-test:
104
+ image: "ruby:3.0.0"
83
105
  stage: tests
84
106
  allow_failure: true
85
107
  extends: .test-template
86
108
  script:
87
109
  - bundle exec rake test
88
110
  cache:
89
- key: "$CI_COMMIT_REF_SLUG 2-6-3"
111
+ key: "$CI_COMMIT_REF_SLUG 3-0-0"
90
112
  paths:
91
113
  - ./*
92
114
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,100 @@
1
1
  # v1.12
2
2
 
3
+ ## Release v1.12.4 - 2021/05/26
4
+
5
+ ### Bug fix
6
+
7
+ * in_tail: Fix a bug that refresh_watcher fails to handle file rotations
8
+
9
+ ## Release v1.12.3 - 2021/04/23
10
+
11
+ ### Enhancement
12
+
13
+ * plugin_helper: Allow TLS to use keep-alive socket option
14
+ https://github.com/fluent/fluentd/pull/3308
15
+
16
+ ### Bug fix
17
+
18
+ * parser_csv, parser_syslog: Fix a naming conflict on parser_type
19
+ https://github.com/fluent/fluentd/pull/3302
20
+ * in_tail: Fix incorrect error code & message on Windows
21
+ https://github.com/fluent/fluentd/pull/3325
22
+ https://github.com/fluent/fluentd/pull/3329
23
+ https://github.com/fluent/fluentd/pull/3331
24
+ https://github.com/fluent/fluentd/pull/3337
25
+ * in_tail: Fix a crash bug on catching a short-lived log
26
+ https://github.com/fluent/fluentd/pull/3328
27
+ * storage_local: Fix position file corruption issue on concurrent gracefulReloads
28
+ https://github.com/fluent/fluentd/pull/3335
29
+ * Fix incorrect warnings about ${chunk_id} with out_s3
30
+ https://github.com/fluent/fluentd/pull/3339
31
+ * TLS Server: Add peer information to error log message
32
+ https://github.com/fluent/fluentd/pull/3330
33
+
34
+ ### Misc
35
+
36
+ * fluent-plugin-generate: add note about plugin name
37
+ https://github.com/fluent/fluentd/pull/3303
38
+ * fluent-plugin-generate: Use same depended gem version with fluentd
39
+ https://github.com/fluent/fluentd/pull/3305
40
+ * Fix some broken unit tests and improve CI's stability
41
+ https://github.com/fluent/fluentd/pull/3304
42
+ https://github.com/fluent/fluentd/pull/3307
43
+ https://github.com/fluent/fluentd/pull/3312
44
+ https://github.com/fluent/fluentd/pull/3313
45
+ https://github.com/fluent/fluentd/pull/3314
46
+ https://github.com/fluent/fluentd/pull/3316
47
+ https://github.com/fluent/fluentd/pull/3336
48
+ * Permit to install with win32-service 2.2.0 on Windows
49
+ https://github.com/fluent/fluentd/pull/3343
50
+
51
+ ## Release v1.12.2 - 2021/03/29
52
+
53
+ ### Enhancement
54
+
55
+ * out_copy: Add ignore_if_prev_successes
56
+ https://github.com/fluent/fluentd/pull/3190
57
+ https://github.com/fluent/fluentd/pull/3287
58
+ * Support multiple kind of timestamp format
59
+ https://github.com/fluent/fluentd/pull/3252
60
+ * formatter_ltsv: suppress delimiters in output
61
+ https://github.com/fluent/fluentd/pull/1666
62
+ https://github.com/fluent/fluentd/pull/3288
63
+ https://github.com/fluent/fluentd/pull/3289
64
+
65
+ ### Bug fix
66
+
67
+ * in_tail: Expect ENOENT during stat
68
+ https://github.com/fluent/fluentd/pull/3275
69
+ * out_forward: Prevent transferring duplicate logs on restart
70
+ https://github.com/fluent/fluentd/pull/3267
71
+ https://github.com/fluent/fluentd/pull/3285
72
+ * in_tail: Handle to send rotated logs when mv is used for rotating
73
+ https://github.com/fluent/fluentd/pull/3294
74
+ * fluent-plugin-config-format: Fill an uninitialized instance variable
75
+ https://github.com/fluent/fluentd/pull/3297
76
+ * Fix MessagePackEventStream issue with Enumerable methods
77
+ https://github.com/fluent/fluentd/pull/2116
78
+
79
+ ### Misc
80
+
81
+ * Add webrick to support Ruby 3.0
82
+ https://github.com/fluent/fluentd/pull/3257
83
+ * Suggest Discource instead of Google Groups
84
+ https://github.com/fluent/fluentd/pull/3261
85
+ * Update MAINTAINERS.md
86
+ https://github.com/fluent/fluentd/pull/3282
87
+ * Introduce DeepSource to check code quality
88
+ https://github.com/fluent/fluentd/pull/3286
89
+ https://github.com/fluent/fluentd/pull/3259
90
+ https://github.com/fluent/fluentd/pull/3291
91
+ * Migrate to GitHub Actions and stabilize tests
92
+ https://github.com/fluent/fluentd/pull/3266
93
+ https://github.com/fluent/fluentd/pull/3268
94
+ https://github.com/fluent/fluentd/pull/3281
95
+ https://github.com/fluent/fluentd/pull/3283
96
+ https://github.com/fluent/fluentd/pull/3290
97
+
3
98
  ## Release v1.12.1 - 2021/02/18
4
99
 
5
100
  ### Enhancement
data/MAINTAINERS.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # Fluentd Maintainers
2
2
 
3
3
  - [Naotoshi Seo](https://github.com/sonots), [ZOZO Technologies](https://tech.zozo.com/en/)
4
- - [Okkez](https://github.com/okkez), [Clearcode](https://www.clear-code.com/)
5
- - [Hiroshi Hatake](https://github.com/cosmo0920), [Clearcode](https://www.clear-code.com/)
4
+ - [Okkez](https://github.com/okkez)
5
+ - [Hiroshi Hatake](https://github.com/cosmo0920), [ClearCode](https://www.clear-code.com/)
6
6
  - [Masahiro Nakagawa](https://github.com/repeatedly), [Treasure Data](https://www.treasuredata.com/)
7
7
  - [Satoshi Tagomori](https://github.com/tagomoris), [Treasure Data](https://www.treasuredata.com/)
8
8
  - [Eduardo Silva](https://github.com/edsiper), [Arm Treasure Data](https://www.treasuredata.com/)
9
+ - [Fujimoto Seiji](https://github.com/fujimots), [ClearCode](https://www.clear-code.com/)
10
+ - [Takuro Ashie](https://github.com/ashie), [ClearCode](https://www.clear-code.com/)
11
+ - [Kentaro Hayashi](https://github.com/kenhys), [ClearCode](https://www.clear-code.com/)
data/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  Fluentd: Open-Source Log Collector
2
2
  ===================================
3
- Travis CI:
3
+ GitHub Actions:
4
4
 
5
- [<img src="https://travis-ci.org/fluent/fluentd.svg" />](https://travis-ci.org/fluent/fluentd) [![Code Climate](https://codeclimate.com/github/fluent/fluentd/badges/gpa.svg)](https://codeclimate.com/github/fluent/fluentd)
5
+ [![Testing on Ubuntu](https://github.com/fluent/fluentd/actions/workflows/linux-test.yaml/badge.svg?branch=master)](https://github.com/fluent/fluentd/actions/workflows/linux-test.yaml)
6
+ [![Testing on Windows](https://github.com/fluent/fluentd/actions/workflows/windows-test.yaml/badge.svg?branch=master)](https://github.com/fluent/fluentd/actions/workflows/windows-test.yaml)
7
+ [![Testing on macOS](https://github.com/fluent/fluentd/actions/workflows/macos-test.yaml/badge.svg?branch=master)](https://github.com/fluent/fluentd/actions/workflows/macos-test.yaml)
8
+ [![Code Climate](https://codeclimate.com/github/fluent/fluentd/badges/gpa.svg)](https://codeclimate.com/github/fluent/fluentd)
6
9
  [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1189/badge)](https://bestpractices.coreinfrastructure.org/projects/1189)
7
10
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ffluent%2Ffluentd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ffluent%2Ffluentd?ref=badge_shield)
8
11
 
data/fluentd.gemspec CHANGED
@@ -28,12 +28,14 @@ Gem::Specification.new do |gem|
28
28
  gem.add_runtime_dependency("tzinfo", [">= 1.0", "< 3.0"])
29
29
  gem.add_runtime_dependency("tzinfo-data", ["~> 1.0"])
30
30
  gem.add_runtime_dependency("strptime", [">= 0.2.2", "< 1.0.0"])
31
+ gem.add_runtime_dependency("webrick", [">= 1.4.2", "< 1.8.0"])
31
32
 
32
33
  # build gem for a certain platform. see also Rakefile
33
34
  fake_platform = ENV['GEM_BUILD_FAKE_PLATFORM'].to_s
34
35
  gem.platform = fake_platform unless fake_platform.empty?
35
36
  if /mswin|mingw/ =~ fake_platform || (/mswin|mingw/ =~ RUBY_PLATFORM && fake_platform.empty?)
36
- gem.add_runtime_dependency("win32-service", ["~> 2.1.5"])
37
+ gem.add_runtime_dependency("win32-api", [">= 1.10", "< 2.0.0"])
38
+ gem.add_runtime_dependency("win32-service", ["~> 2.2.0"])
37
39
  gem.add_runtime_dependency("win32-ipc", ["~> 0.7.0"])
38
40
  gem.add_runtime_dependency("win32-event", ["~> 0.6.3"])
39
41
  gem.add_runtime_dependency("windows-pr", ["~> 1.2.6"])
@@ -44,7 +46,7 @@ Gem::Specification.new do |gem|
44
46
  gem.add_development_dependency("flexmock", ["~> 2.0"])
45
47
  gem.add_development_dependency("parallel_tests", ["~> 0.15.3"])
46
48
  gem.add_development_dependency("simplecov", ["~> 0.7"])
47
- gem.add_development_dependency("rr", ["~> 1.0"])
49
+ gem.add_development_dependency("rr", ["~> 3.0"])
48
50
  gem.add_development_dependency("timecop", ["~> 0.9"])
49
51
  gem.add_development_dependency("test-unit", ["~> 3.3"])
50
52
  gem.add_development_dependency("test-unit-rr", ["~> 1.0"])
@@ -40,6 +40,6 @@ else
40
40
  File.expand_path(File.join(File.dirname(__FILE__), 'fluentd.rb')),
41
41
  ] + ARGV
42
42
 
43
- exec *cmdline
43
+ exec(*cmdline)
44
44
  exit! 127
45
45
  end
@@ -101,7 +101,6 @@ rescue
101
101
  usage $!.to_s
102
102
  end
103
103
 
104
- require 'thread'
105
104
  require 'socket'
106
105
  require 'yajl'
107
106
  require 'msgpack'
@@ -44,6 +44,7 @@ class FluentPluginConfigFormatter
44
44
  @verbose = false
45
45
  @libs = []
46
46
  @plugin_dirs = []
47
+ @table = false
47
48
  @options = {}
48
49
 
49
50
  prepare_option_parser
@@ -162,7 +163,7 @@ class FluentPluginConfigFormatter
162
163
  else
163
164
  sections, params = base_section.partition {|_name, value| value[:section] }
164
165
  end
165
- if @table and not params.empty?
166
+ if @table && (not params.empty?)
166
167
  dumped << "### Configuration\n\n"
167
168
  dumped << "|parameter|type|description|default|\n"
168
169
  dumped << "|---|---|---|---|\n"
@@ -105,7 +105,7 @@ Generate a project skeleton for creating a Fluentd plugin
105
105
 
106
106
  Arguments:
107
107
  \ttype: #{SUPPORTED_TYPES.join(",")}
108
- \tname: Your plugin name
108
+ \tname: Your plugin name (fluent-plugin- prefix will be added to <name>)
109
109
 
110
110
  Options:
111
111
  BANNER
@@ -151,6 +151,36 @@ BANNER
151
151
  underscore_name
152
152
  end
153
153
 
154
+ def gem_file_path
155
+ File.expand_path(File.join(File.dirname(__FILE__),
156
+ "../../../",
157
+ "Gemfile"))
158
+ end
159
+
160
+ def lock_file_path
161
+ File.expand_path(File.join(File.dirname(__FILE__),
162
+ "../../../",
163
+ "Gemfile.lock"))
164
+ end
165
+
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
169
+ end
170
+
171
+ def rake_version
172
+ locked_gem_version("rake")
173
+ end
174
+
175
+ def test_unit_version
176
+ locked_gem_version("test-unit")
177
+ end
178
+
179
+ def bundler_version
180
+ d = Bundler::Definition.build(gem_file_path, lock_file_path, false)
181
+ d.locked_gems.bundler_version.version
182
+ end
183
+
154
184
  def class_name
155
185
  "#{capitalized_name}#{type.capitalize}"
156
186
  end
@@ -244,10 +244,10 @@ module Fluent
244
244
  end
245
245
 
246
246
  def convert_value_to_nil(value)
247
- if value and @null_empty_string
247
+ if value && @null_empty_string
248
248
  value = (value == '') ? nil : value
249
249
  end
250
- if value and @null_value_pattern
250
+ if value && @null_value_pattern
251
251
  value = ::Fluent::StringUtil.match_regexp(@null_value_pattern, value) ? nil : value
252
252
  end
253
253
  value
@@ -179,7 +179,7 @@ module Fluent
179
179
  end
180
180
 
181
181
  if section_params[varname].nil?
182
- unless proxy.defaults.has_key?(varname) and proxy.defaults[varname].nil?
182
+ unless proxy.defaults.has_key?(varname) && proxy.defaults[varname].nil?
183
183
  logger.error "config error in:\n#{conf}" if logger
184
184
  raise ConfigError, "'#{name}' parameter is required but nil is specified"
185
185
  end
@@ -186,7 +186,7 @@ module Fluent
186
186
  return nil if val.nil?
187
187
 
188
188
  param = if val.is_a?(String)
189
- val.start_with?('{') ? JSON.load(val) : Hash[val.strip.split(/\s*,\s*/).map{|v| v.split(':', 2)}]
189
+ val.start_with?('{') ? JSON.parse(val) : Hash[val.strip.split(/\s*,\s*/).map{|v| v.split(':', 2)}]
190
190
  else
191
191
  val
192
192
  end
@@ -213,7 +213,7 @@ module Fluent
213
213
  return nil if val.nil?
214
214
 
215
215
  param = if val.is_a?(String)
216
- val.start_with?('[') ? JSON.load(val) : val.strip.split(/\s*,\s*/)
216
+ val.start_with?('[') ? JSON.parse(val) : val.strip.split(/\s*,\s*/)
217
217
  else
218
218
  val
219
219
  end
data/lib/fluent/event.rb CHANGED
@@ -254,19 +254,9 @@ module Fluent
254
254
  end
255
255
 
256
256
  def each(unpacker: nil, &block)
257
- if @unpacked_times
258
- @unpacked_times.each_with_index do |time, i|
259
- block.call(time, @unpacked_records[i])
260
- end
261
- else
262
- @unpacked_times = []
263
- @unpacked_records = []
264
- (unpacker || Fluent::MessagePackFactory.msgpack_unpacker).feed_each(@data) do |time, record|
265
- @unpacked_times << time
266
- @unpacked_records << record
267
- block.call(time, record)
268
- end
269
- @size = @unpacked_times.size
257
+ ensure_unpacked!(unpacker: unpacker)
258
+ @unpacked_times.each_with_index do |time, i|
259
+ block.call(time, @unpacked_records[i])
270
260
  end
271
261
  nil
272
262
  end
data/lib/fluent/load.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'thread'
2
1
  require 'socket'
3
2
  require 'fcntl'
4
3
  require 'time'
@@ -46,6 +46,42 @@ module Fluent
46
46
  end
47
47
  end
48
48
 
49
+ class Win32Error < StandardError
50
+ require 'windows/error'
51
+ include Windows::Error
52
+
53
+ attr_reader :errcode, :msg
54
+
55
+ def initialize(errcode, msg = nil)
56
+ @errcode = errcode
57
+ @msg = msg
58
+ end
59
+
60
+ def format_english_message(errcode)
61
+ buf = 0.chr * 260
62
+ flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY
63
+ english_lang_id = 1033 # The result of MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)
64
+ FormatMessageA.call(flags, 0, errcode, english_lang_id, buf, buf.size, 0)
65
+ buf.force_encoding(Encoding.default_external).strip
66
+ end
67
+
68
+ def to_s
69
+ msg = super
70
+ msg << ": code: #{@errcode}, #{format_english_message(@errcode)}"
71
+ msg << " - #{@msg}" if @msg
72
+ msg
73
+ end
74
+
75
+ def inspect
76
+ "#<#{to_s}>"
77
+ end
78
+
79
+ def ==(other)
80
+ return false if other.class != Win32Error
81
+ @errcode == other.errcode && @msg == other.msg
82
+ end
83
+ end
84
+
49
85
  # To open and get stat with setting FILE_SHARE_DELETE
50
86
  class WindowsFile
51
87
  require 'windows/file'
@@ -77,11 +113,11 @@ module Fluent
77
113
  @file_handle = CreateFile.call(@path, access, sharemode,
78
114
  0, creationdisposition, FILE_ATTRIBUTE_NORMAL, 0)
79
115
  if @file_handle == INVALID_HANDLE_VALUE
80
- err = GetLastError.call
116
+ err = Win32::API.last_error
81
117
  if err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND || err == ERROR_ACCESS_DENIED
82
- raise SystemCallError.new(2)
118
+ raise Errno::ENOENT
83
119
  end
84
- raise SystemCallError.new(err)
120
+ raise Win32Error.new(err, path)
85
121
  end
86
122
  end
87
123
 
@@ -27,14 +27,14 @@ module Fluent
27
27
 
28
28
  config_param :delimiter, :string, default: "\t".freeze
29
29
  config_param :label_delimiter, :string, default: ":".freeze
30
+ config_param :replacement, :string, default: " ".freeze
30
31
  config_param :add_newline, :bool, default: true
31
32
 
32
- # TODO: escaping for \t in values
33
33
  def format(tag, time, record)
34
34
  formatted = ""
35
35
  record.each do |label, value|
36
36
  formatted << @delimiter if formatted.length.nonzero?
37
- formatted << "#{label}#{@label_delimiter}#{value}"
37
+ formatted << "#{label}#{@label_delimiter}#{value.to_s.gsub(@delimiter, @replacement)}"
38
38
  end
39
39
  formatted << @newline if @add_newline
40
40
  formatted
@@ -503,7 +503,7 @@ module Fluent::Plugin
503
503
  # For every incoming request, we check if we have some CORS
504
504
  # restrictions and allow listed origins through @cors_allow_origins.
505
505
  unless @cors_allow_origins.nil?
506
- unless @cors_allow_origins.include?('*') or include_cors_allow_origin
506
+ unless @cors_allow_origins.include?('*') || include_cors_allow_origin
507
507
  send_response_and_close(RES_403_STATUS, {'Connection' => 'close'}, "")
508
508
  return
509
509
  end