fluent-plugin-cwm-http 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +90 -0
- data/.gitignore +58 -0
- data/.rubocop.yml +17 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +63 -0
- data/LICENSE +202 -0
- data/README.md +185 -0
- data/Rakefile +15 -0
- data/bin/update_version.sh +9 -0
- data/fluent-plugin-cwm-http.gemspec +30 -0
- data/lib/fluent/plugin/in_http_cwm.rb +299 -0
- data/test/helper.rb +13 -0
- data/test/logs.txt +29 -0
- data/test/plugin/test_in_http_cwm.rb +125 -0
- metadata +196 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e59dbc9e784a39e3eae1c8068e56b95aeb44879a083d865eaaee79849ecca6c4
|
4
|
+
data.tar.gz: d0909fbfa4a555ab9afb2026a84ca732b138ff9824d277924730bc3d1179706c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f59f96903358085aa0cd2473551051a05db4dffd44b8b8f7818e496482922f63728cfde086e4bb3845a173df41f05f07bbb9880d4c8c352afd982d67bf7dc31
|
7
|
+
data.tar.gz: c44863e76f8a58f3531fd3bb6c131a1f516a12f9e80aed7206d52cd96c970cad77d2af061fe69bfbb79081ecf91343a350a3b12f734872bb25bdabb3af5c4688
|
@@ -0,0 +1,90 @@
|
|
1
|
+
name: ci
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
paths-ignore:
|
6
|
+
- '**.md'
|
7
|
+
- '.rubocop.yml'
|
8
|
+
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- '**.md'
|
11
|
+
- '.rubocop.yml'
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
run-tests:
|
15
|
+
name: Run tests
|
16
|
+
strategy:
|
17
|
+
matrix:
|
18
|
+
os: [ubuntu-18.04]
|
19
|
+
ruby-version: ['2.5', '2.6', '2.7']
|
20
|
+
|
21
|
+
runs-on: ${{ matrix.os }}
|
22
|
+
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v2
|
25
|
+
|
26
|
+
- name: Set up Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby-version }}
|
30
|
+
bundler-cache: true
|
31
|
+
|
32
|
+
- name: Bundle install
|
33
|
+
run: |
|
34
|
+
gem install bundler && \
|
35
|
+
bundle install --jobs 4 --retry 3
|
36
|
+
|
37
|
+
- name: Install Redis
|
38
|
+
run: sudo apt install redis-server
|
39
|
+
|
40
|
+
- name: Tests
|
41
|
+
run: bundle exec rake test
|
42
|
+
|
43
|
+
publish:
|
44
|
+
needs: "run-tests"
|
45
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
46
|
+
|
47
|
+
name: Publish Gem
|
48
|
+
runs-on: ubuntu-18.04
|
49
|
+
|
50
|
+
steps:
|
51
|
+
- uses: actions/checkout@v2
|
52
|
+
- name: Set up Ruby 2.6
|
53
|
+
uses: ruby/setup-ruby@v1
|
54
|
+
with:
|
55
|
+
ruby-version: 2.6
|
56
|
+
- run: bundle install
|
57
|
+
|
58
|
+
- name: Build and publish RubyGem
|
59
|
+
env:
|
60
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
|
61
|
+
run: |
|
62
|
+
mkdir -p $HOME/.gem && \
|
63
|
+
touch $HOME/.gem/credentials && \
|
64
|
+
chmod 0600 $HOME/.gem/credentials && \
|
65
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials && \
|
66
|
+
bin/update_version "${GITHUB_REF#refs/tags/v}" &&\
|
67
|
+
gem build fluent-plugin-cwm-http.gemspec && \
|
68
|
+
gem push "fluent-plugin-cwm-http-${GITHUB_REF#refs/tags/v}.gem" && \
|
69
|
+
echo "Gem published successfully!"
|
70
|
+
|
71
|
+
- name: Update version file on CloudWebManage/cwm-worker-logger
|
72
|
+
env:
|
73
|
+
DEPLOY_KEY: ${{ secrets.CWM_WORKER_LOGGER_DEPLOY_KEY }}
|
74
|
+
DEPLOY_KEY_FILE: cwm_worker_logger_deploy_key
|
75
|
+
GEM_NAME: fluent-plugin-cwm-http
|
76
|
+
run: |
|
77
|
+
version="${GITHUB_REF#refs/tags/v}" && \
|
78
|
+
echo "Version: " $version && \
|
79
|
+
echo "$DEPLOY_KEY" > $DEPLOY_KEY_FILE && \
|
80
|
+
chmod 400 $DEPLOY_KEY_FILE && \
|
81
|
+
export GIT_SSH_COMMAND="ssh -i $(pwd)/$DEPLOY_KEY_FILE -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" && \
|
82
|
+
git clone git@github.com:CloudWebManage/cwm-worker-logger.git && \
|
83
|
+
cd cwm-worker-logger && \
|
84
|
+
git config user.name "$GEM_NAME CI" && \
|
85
|
+
git config user.email "$GEM_NAME-ci@localhost" && \
|
86
|
+
echo $version > $GEM_NAME.version && \
|
87
|
+
git add $GEM_NAME.version && \
|
88
|
+
git commit -m "Automatic version update for $GEM_NAME gem." && \
|
89
|
+
git push origin main && \
|
90
|
+
echo "Version updated successfully!"
|
data/.gitignore
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
57
|
+
|
58
|
+
.idea
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: disable
|
3
|
+
|
4
|
+
Gemspec/RequiredRubyVersion:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Metrics/ClassLength:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/MethodLength:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Metrics/AbcSize:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Layout/LineLength:
|
17
|
+
Enabled: false
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fluent-plugin-cwm-http (0.3.1)
|
5
|
+
fluentd (>= 0.14.10, < 2)
|
6
|
+
json (~> 2.3, >= 2.3.0)
|
7
|
+
redis (~> 4.2, >= 4.2.5)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
concurrent-ruby (1.1.8)
|
13
|
+
cool.io (1.7.1)
|
14
|
+
docile (1.3.5)
|
15
|
+
fluentd (1.12.2)
|
16
|
+
bundler
|
17
|
+
cool.io (>= 1.4.5, < 2.0.0)
|
18
|
+
http_parser.rb (>= 0.5.1, < 0.7.0)
|
19
|
+
msgpack (>= 1.3.1, < 2.0.0)
|
20
|
+
serverengine (>= 2.2.2, < 3.0.0)
|
21
|
+
sigdump (~> 0.2.2)
|
22
|
+
strptime (>= 0.2.2, < 1.0.0)
|
23
|
+
tzinfo (>= 1.0, < 3.0)
|
24
|
+
tzinfo-data (~> 1.0)
|
25
|
+
webrick (>= 1.4.2, < 1.8.0)
|
26
|
+
yajl-ruby (~> 1.0)
|
27
|
+
http_parser.rb (0.6.0)
|
28
|
+
json (2.5.1)
|
29
|
+
msgpack (1.4.2)
|
30
|
+
power_assert (2.0.0)
|
31
|
+
rake (12.3.3)
|
32
|
+
redis (4.2.5)
|
33
|
+
serverengine (2.2.3)
|
34
|
+
sigdump (~> 0.2.2)
|
35
|
+
sigdump (0.2.4)
|
36
|
+
simplecov (0.21.2)
|
37
|
+
docile (~> 1.1)
|
38
|
+
simplecov-html (~> 0.11)
|
39
|
+
simplecov_json_formatter (~> 0.1)
|
40
|
+
simplecov-html (0.12.3)
|
41
|
+
simplecov_json_formatter (0.1.2)
|
42
|
+
strptime (0.2.5)
|
43
|
+
test-unit (3.4.0)
|
44
|
+
power_assert
|
45
|
+
tzinfo (2.0.4)
|
46
|
+
concurrent-ruby (~> 1.0)
|
47
|
+
tzinfo-data (1.2021.1)
|
48
|
+
tzinfo (>= 1.0.0)
|
49
|
+
webrick (1.7.0)
|
50
|
+
yajl-ruby (1.4.1)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
ruby
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
bundler (>= 1.14, < 3)
|
57
|
+
fluent-plugin-cwm-http!
|
58
|
+
rake (~> 12.3, >= 12.3.3)
|
59
|
+
simplecov
|
60
|
+
test-unit (~> 3.0)
|
61
|
+
|
62
|
+
BUNDLED WITH
|
63
|
+
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright 2020 Azeem Sajid
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
# fluent-plugin-http-cwm
|
2
|
+
|
3
|
+
- [Overview](#overview)
|
4
|
+
- [Installation](#installation)
|
5
|
+
- [RubyGems](#rubygems)
|
6
|
+
- [Bundler](#bundler)
|
7
|
+
- [Configuration](#configuration)
|
8
|
+
- [`<redis>` section (optional) (single)](#redis-section-optional-single)
|
9
|
+
- [Sample Configuration](#sample-configuration)
|
10
|
+
- [Contribute](#contribute)
|
11
|
+
- [Publish the gem](#publish-the-gem)
|
12
|
+
- [License](#license)
|
13
|
+
|
14
|
+
## Overview
|
15
|
+
|
16
|
+
[Fluentd](https://fluentd.org/) HTTP input plugin for
|
17
|
+
[CloudWebManage](https://github.com/CloudWebManage) Logging Component.
|
18
|
+
|
19
|
+
This plugin:
|
20
|
+
|
21
|
+
1. receives the incoming JSON logs from MinIO using an HTTP endpoint,
|
22
|
+
2. validates the required JSON fields,
|
23
|
+
3. aggregates the logging metrics,
|
24
|
+
4. flushes the aggregated metrics to the configured Redis instance; and,
|
25
|
+
5. routes logs to the configured log targets e.g. S3, ElasticSearch, etc.
|
26
|
+
|
27
|
+
```text
|
28
|
+
+------------------+
|
29
|
+
| MinIO |
|
30
|
+
+------------------+
|
31
|
+
|
|
32
|
+
| JSON
|
33
|
+
| logs
|
34
|
+
v
|
35
|
+
+------------------+
|
36
|
+
| fluentd |
|
37
|
+
| |
|
38
|
+
| +--------------+ | +-----------------+
|
39
|
+
| | http_cwm | | [metrics] | Redis |
|
40
|
+
| | (input) |-------------------->| Server |
|
41
|
+
| +--------------+ | +-----------------+
|
42
|
+
| |
|
43
|
+
| +--------------+ | +-----------------+
|
44
|
+
| | s3 | | [raw logs] | S3 |
|
45
|
+
| | (output) |-------------------->| (log target) |
|
46
|
+
| +--------------+ | +-----------------+
|
47
|
+
| |
|
48
|
+
| +--------------+ | +-----------------+
|
49
|
+
| |elasticsearch | | [raw logs] | ElasticSearch |
|
50
|
+
| | (output) |-------------------->| (log target) |
|
51
|
+
| +--------------+ | +-----------------+
|
52
|
+
| |
|
53
|
+
+------------------+
|
54
|
+
```
|
55
|
+
|
56
|
+
The following metrics are aggregated:
|
57
|
+
|
58
|
+
| metric | description |
|
59
|
+
| :------------------ | :------------------------------------------------- |
|
60
|
+
| `bytes_in` | size of Request header and its Content-Length |
|
61
|
+
| `bytes_out` | size of Response header and its Content-Length |
|
62
|
+
| `num_requests_in` | count of APIs [WebUpload, PutObject, DeleteObject] |
|
63
|
+
| `num_requests_out` | count of APIs [WebDownload, GetObject] |
|
64
|
+
| `num_requests_misc` | count of APIs other than `in` and `out` |
|
65
|
+
|
66
|
+
## Installation
|
67
|
+
|
68
|
+
### RubyGems
|
69
|
+
|
70
|
+
```shell
|
71
|
+
gem install fluent-plugin-cwm-http
|
72
|
+
```
|
73
|
+
|
74
|
+
### Bundler
|
75
|
+
|
76
|
+
Add the following line to your Gemfile:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
gem 'fluent-plugin-cwm-http'
|
80
|
+
```
|
81
|
+
|
82
|
+
And then execute:
|
83
|
+
|
84
|
+
```shell
|
85
|
+
bundle
|
86
|
+
```
|
87
|
+
|
88
|
+
## Configuration
|
89
|
+
|
90
|
+
- `host` (string) (optional): The address to bind to.
|
91
|
+
- Default value: `localhost`.
|
92
|
+
- `port` (integer) (optional): The port to listen to.
|
93
|
+
- Default value: `8080`.
|
94
|
+
- `tag` (string) (required): The tag for the event.
|
95
|
+
|
96
|
+
### `<redis>` section (optional) (single)
|
97
|
+
|
98
|
+
- `host` (string) (optional): The address of Redis server.
|
99
|
+
- Default value: `localhost`.
|
100
|
+
- `port` (integer) (optional): The port of Redis server.
|
101
|
+
- Default value: `6379`.
|
102
|
+
- `db` (integer) (optional): The db to use.
|
103
|
+
- Default value: `0`.
|
104
|
+
- `grace_period` (time) (optional): The grace period for last action update.
|
105
|
+
- Default value: `300s`.
|
106
|
+
- `flush_interval` (time) (optional): The flush interval to send metrics.
|
107
|
+
- Default value: `300s`.
|
108
|
+
- `last_update_prefix` (string) (optional): The prefix for last update key.
|
109
|
+
- Default value: `deploymentid:last_action`.
|
110
|
+
- `metrics_prefix` (string) (optional): The prefix for metrics key.
|
111
|
+
- Default value: `deploymentid:minio-metrics`.
|
112
|
+
|
113
|
+
### Sample Configuration
|
114
|
+
|
115
|
+
```text
|
116
|
+
# Endpoint for incoming logs: http://host:port/<tag>
|
117
|
+
|
118
|
+
# HTTP Input
|
119
|
+
<source>
|
120
|
+
@type http_cwm
|
121
|
+
@id http_cwm_logs
|
122
|
+
|
123
|
+
host localhost
|
124
|
+
port 8080
|
125
|
+
|
126
|
+
tag logs
|
127
|
+
|
128
|
+
<redis>
|
129
|
+
host localhost
|
130
|
+
port 6379
|
131
|
+
db 0
|
132
|
+
grace_period 10s
|
133
|
+
flush_interval 10s
|
134
|
+
last_update_prefix deploymentid:last_action
|
135
|
+
metrics_prefix deploymentid:minio-metrics
|
136
|
+
</redis>
|
137
|
+
</source>
|
138
|
+
|
139
|
+
# Output e.g. ElasticSearch, S3, etc.
|
140
|
+
<match logs>
|
141
|
+
@type elasticsearch
|
142
|
+
# ...
|
143
|
+
</match>
|
144
|
+
```
|
145
|
+
|
146
|
+
The environment variables may also be used for the configuration.
|
147
|
+
|
148
|
+
Example:
|
149
|
+
|
150
|
+
```text
|
151
|
+
<source>
|
152
|
+
@type http_cwm
|
153
|
+
@id http_cwm_logs
|
154
|
+
|
155
|
+
host "#{ENV['HTTP_HOST']}"
|
156
|
+
port "#{ENV['HTTP_PORT']}"
|
157
|
+
|
158
|
+
# ...
|
159
|
+
</source>
|
160
|
+
```
|
161
|
+
|
162
|
+
## Contribute
|
163
|
+
|
164
|
+
- Fork the project.
|
165
|
+
- Check out the latest `main` branch.
|
166
|
+
- Create a feature or bugfix branch from `main`.
|
167
|
+
- Commit and push your changes.
|
168
|
+
- Make sure to add and run tests locally: `bundle exec rake test`.
|
169
|
+
- Run Rubocop locally and fix all the lint warnings.
|
170
|
+
- Make sure to update [Gemfile.lock](Gemfile.lock): `sudo bundle update`.
|
171
|
+
- Submit the PR.
|
172
|
+
|
173
|
+
## Publish the gem
|
174
|
+
|
175
|
+
The gem is published via the [publish.yml](.github/workflows/publish.yml)
|
176
|
+
Workflow on tagging. The tag must be of the format `v0.3.0`. This workflow
|
177
|
+
depends on the successful completion of the [ci.yml](.github/workflows/ci.yml)
|
178
|
+
workflow and then it looks for the tag. So, make sure that all the CI issues are
|
179
|
+
resolved before creating a new tag. If there are issues while publishing the gem
|
180
|
+
i.e. publish workflow doesn't work properly, you can delete and then recreate
|
181
|
+
the tag to retrigger this workflow.
|
182
|
+
|
183
|
+
## License
|
184
|
+
|
185
|
+
[Apache 2.0](./LICENSE)
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'rake/testtask'
|
7
|
+
|
8
|
+
Rake::TestTask.new(:test) do |t|
|
9
|
+
t.libs.push('lib', 'test')
|
10
|
+
t.test_files = FileList['test/**/test_*.rb']
|
11
|
+
t.verbose = true
|
12
|
+
t.warning = true
|
13
|
+
end
|
14
|
+
|
15
|
+
task default: [:test]
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
VERSION="${1}"
|
4
|
+
|
5
|
+
[ -z "${VERSION}" ] && echo missing VERSION && exit 1
|
6
|
+
|
7
|
+
echo updating gem version to "${VERSION}" &&\
|
8
|
+
sed -i 's/fluent-plugin-cwm-http (0.0.0)/fluent-plugin-cwm-http ('"${VERSION}"')/' Gemfile.lock &&\
|
9
|
+
sed -i "s/= '0.0.0'/= '${VERSION}'/" fluent-plugin-cwm-http.gemspec
|