influxdb-plugin-fluent 1.0.0.pre.183

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 586e7cac5815b5971c5319c2bfdee945f54f6234b95f4182f724be662a739b73
4
+ data.tar.gz: 927543219dd34a2b7e3c02ee59425a3febdcccaf15014b2c42db73ca7fec89d0
5
+ SHA512:
6
+ metadata.gz: '097c45fe9ffbae901318e69e864d70b4bd165c84bf1446c804dd9204ceb10d7d134ebb449d0cbdbe4e4f4d57d2b68e0159a110cd7cdef81a67d15e8841c5eeca'
7
+ data.tar.gz: 2b7fc3dcbfcb49480779d1ffda1471885920df99a62b90cecab1c5e8606a190c0e1b5b7205e4ed9d68565e8b7d388efb30028b4262e0d1bba44a621a433641ff
@@ -0,0 +1,157 @@
1
+ #
2
+ # The MIT License
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #
22
+
23
+ version: 2.1
24
+
25
+ commands:
26
+ influxdb-onboarding:
27
+ steps:
28
+ - run:
29
+ name: "Post onBoarding request to InfluxDB 2"
30
+ command: ./bin/influxdb-onboarding.sh
31
+ prepare:
32
+ description: "Prepare environment to tests"
33
+ steps:
34
+ - checkout
35
+ - influxdb-onboarding
36
+ test:
37
+ parameters:
38
+ ruby-image:
39
+ type: string
40
+ steps:
41
+ - restore_cache:
42
+ name: Restoring Gem Cache
43
+ keys:
44
+ - &cache-key gem-cache-{{ checksum "influxdb-plugin-fluent.gemspec" }}-<< parameters.ruby-image >>
45
+ - gem-cache-{{ checksum "influxdb-plugin-fluent.gemspec" }}
46
+ - gem-cache-
47
+ - run:
48
+ name: Install dependencies
49
+ command: |
50
+ gem install bundler
51
+ bundle config set path 'vendor/bundle'
52
+ bundle install --jobs=4 --retry=3
53
+ - run:
54
+ name: Static code analyze
55
+ command: |
56
+ bundle exec rake rubocop
57
+ - run:
58
+ name: Run tests
59
+ command: |
60
+ export MINITEST_REPORTER=JUnitReporter
61
+ bundle exec rake test
62
+ - save_cache:
63
+ name: Saving Gem Cache
64
+ key: *cache-key
65
+ paths:
66
+ - ./vendor/bundle
67
+ when: always
68
+ storing-test-results:
69
+ steps:
70
+ - store_test_results:
71
+ path: test/reports
72
+
73
+ jobs:
74
+ tests-ruby:
75
+ parameters:
76
+ ruby-image:
77
+ type: string
78
+ default: &default-ruby-image "circleci/ruby:2.6-stretch"
79
+ influxdb-image:
80
+ type: string
81
+ default: &default-influxdb-image "influxdb:2.0.0-beta"
82
+ docker:
83
+ - image: << parameters.ruby-image >>
84
+ - image: &influx-image quay.io/influxdb/<< parameters.influxdb-image >>
85
+ steps:
86
+ - prepare
87
+ - test:
88
+ ruby-image: << parameters.ruby-image >>
89
+ - storing-test-results
90
+
91
+ deploy-preview:
92
+ parameters:
93
+ influxdb-image:
94
+ type: string
95
+ default: *default-influxdb-image
96
+ docker:
97
+ - image: *default-ruby-image
98
+ - image: *influx-image
99
+ steps:
100
+ - run:
101
+ name: Early return if this build is from a forked repository
102
+ command: |
103
+ if [[ $CIRCLE_PROJECT_USERNAME != "bonitoo-io" ]]; then
104
+ echo "Nothing to do for forked repositories, so marking this step successful"
105
+ circleci step halt
106
+ fi
107
+ - checkout
108
+ - run:
109
+ name: Setup Rubygems
110
+ command: bash .circleci/setup-rubygems.sh
111
+ - run:
112
+ name: Build a Gem bundle
113
+ command: |
114
+ gem build influxdb-plugin-fluent.gemspec
115
+ - run:
116
+ name: Deploy pre-release into https://rubygems.org
117
+ command: |
118
+ gem push influxdb-plugin-fluent-*.pre.$CIRCLE_BUILD_NUM.gem
119
+ workflows:
120
+ version: 2
121
+ build:
122
+ jobs:
123
+ - tests-ruby:
124
+ name: ruby-2.7
125
+ ruby-image: "circleci/ruby:2.7-buster"
126
+ - tests-ruby:
127
+ name: ruby-2.6
128
+ - tests-ruby:
129
+ name: ruby-2.6-nightly
130
+ influxdb-image: "influx:nightly"
131
+ - tests-ruby:
132
+ name: ruby-2.5
133
+ ruby-image: "circleci/ruby:2.5-stretch"
134
+ - tests-ruby:
135
+ name: ruby-2.4
136
+ ruby-image: "circleci/ruby:2.4-stretch"
137
+ - deploy-preview:
138
+ requires:
139
+ - ruby-2.7
140
+ - ruby-2.6
141
+ - ruby-2.6-nightly
142
+ - ruby-2.5
143
+ - ruby-2.4
144
+ filters:
145
+ branches:
146
+ only: master
147
+
148
+ nightly:
149
+ triggers:
150
+ - schedule:
151
+ cron: "0 0 * * *"
152
+ filters:
153
+ branches:
154
+ only:
155
+ - master
156
+ jobs:
157
+ - tests-ruby
@@ -0,0 +1,3 @@
1
+ mkdir ~/.gem || true
2
+ echo -e "---\r\n:rubygems_api_key: $GEM_HOST_API_KEY" > ~/.gem/credentials
3
+ chmod 0600 /home/circleci/.gem/credentials
@@ -0,0 +1,8 @@
1
+ Closes #
2
+
3
+ _Briefly describe your proposed changes:_
4
+
5
+ - [ ] CHANGELOG.md updated
6
+ - [ ] Rebased/mergeable
7
+ - [ ] Tests pass
8
+ - [ ] Sign [CLA](https://influxdata.com/community/cla/) (if not already signed)
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.idea/
3
+ /.yardoc
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /Gemfile.lock
11
+ /test/reports/
12
+ .rakeTasks
13
+ **/influxdb-plugin-fluent*.gem
@@ -0,0 +1,36 @@
1
+ #
2
+ # The MIT License
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #
22
+
23
+ Metrics/LineLength:
24
+ Max: 120
25
+ Metrics/MethodLength:
26
+ Max: 40
27
+ Metrics/ClassLength:
28
+ Max: 350
29
+ Metrics/AbcSize:
30
+ Max: 40
31
+ Metrics/BlockLength:
32
+ Max: 40
33
+ Metrics/CyclomaticComplexity:
34
+ Max: 15
35
+ Metrics/PerceivedComplexity:
36
+ Max: 15
@@ -0,0 +1,3 @@
1
+ ## 1.0.0 [unreleased]
2
+
3
+
data/Gemfile ADDED
@@ -0,0 +1,24 @@
1
+ # The MIT License
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ source 'https://rubygems.org'
22
+
23
+ # Specify your gem's dependencies in influxdb-plugin-fluent.gemspec
24
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Influxdata, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,112 @@
1
+ # influxdb-plugin-fluent
2
+
3
+ [![CircleCI](https://circleci.com/gh/bonitoo-io/influxdb-plugin-fluent.svg?style=svg)](https://circleci.com/gh/bonitoo-io/influxdb-plugin-fluent)
4
+ [![codecov](https://codecov.io/gh/bonitoo-io/influxdb-plugin-fluent/branch/master/graph/badge.svg)](https://codecov.io/gh/bonitoo-io/influxdb-plugin-fluent)
5
+ [![Gem Version](https://badge.fury.io/rb/influxdb-plugin-fluent.svg)](https://badge.fury.io/rb/influxdb-plugin-fluent)
6
+ [![License](https://img.shields.io/github/license/bonitoo-io/influxdb-plugin-fluent.svg)](https://github.com/bonitoo-io/influxdb-plugin-fluent/blob/master/LICENSE)
7
+ [![GitHub issues](https://img.shields.io/github/issues-raw/bonitoo-io/influxdb-plugin-fluent.svg)](https://github.com/bonitoo-io/influxdb-plugin-fluent/issues)
8
+ [![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/bonitoo-io/influxdb-plugin-fluent.svg)](https://github.com/bonitoo-io/influxdb-plugin-fluent/pulls)
9
+
10
+ This repository contains the reference Fluentd plugin for the InfluxDB 2.0.
11
+
12
+ #### Note: This plugin is for use with InfluxDB 2.x. For InfluxDB 1.x instances, please use the [fluent-plugin-influxdb](https://github.com/fangli/fluent-plugin-influxdb) plugin.
13
+
14
+ ## Installation
15
+
16
+ ### Gems
17
+
18
+ The plugin is bundled as a gem and is hosted on [Rubygems](https://rubygems.org/gems/influxdb-plugin-fluent). You can install the gem as follows:
19
+
20
+ ```
21
+ fluent-gem install influxdb-plugin-fluent
22
+ ```
23
+
24
+ ## Plugins
25
+
26
+ ### influxdb2
27
+
28
+ Store Fluentd event to InfluxDB 2 database.
29
+
30
+ #### Configuration
31
+
32
+ | Option | Description | Type | Default |
33
+ |---|---|---|---|
34
+ | url | InfluxDB URL to connect to (ex. https://localhost:9999). | String | https://localhost:9999 |
35
+ | token | Access Token used for authenticating/authorizing the InfluxDB request sent by client. | String | |
36
+ | use_ssl | Turn on/off SSL for HTTP communication. | bool | true |
37
+ | bucket | Specifies the destination bucket for writes. | String | |
38
+ | org | Specifies the destination organization for writes. | String | |
39
+ | measurement | The name of the measurement. If not specified, Fluentd's tag is used. | String | nil |
40
+ | tag_keys | The list of record keys that are stored in InfluxDB as 'tag'. | Array | [] |
41
+ | tag_fluentd | Specifies if the Fluentd's event tag is included into InfluxDB tags (ex. 'fluentd=system.logs'). | bool | false |
42
+ | field_keys | The list of record keys that are stored in InfluxDB as 'field'. If it's not specified than as fields are used all record keys. | Array | [] |
43
+ | field_cast_to_float | Turn on/off auto casting Integer value to Float. Helper to avoid mismatch error: 'series type mismatch: already Integer but got Float'. | bool | false |
44
+ | time_precision | The time precision of timestamp. You should specify either second (s), millisecond (ms), microsecond (us), or nanosecond (ns). | String | ns |
45
+ | time_key | A name of the record key that used as a 'timestamp' instead of event timestamp. If a record key doesn't exists or hasn't value then is used event timestamp. | String | nil |
46
+
47
+ ##### Minimal configuration
48
+
49
+ ```
50
+ <match influxdb2.**>
51
+ @type influxdb2
52
+
53
+ # InfluxDB URL to connect to (ex. https://localhost:9999).
54
+ url https://localhost:9999
55
+ # Access Token used for authenticating/authorizing the InfluxDB request sent by client.
56
+ token my-token
57
+
58
+ # Specifies the destination bucket for writes.
59
+ bucket my-bucket
60
+ # Specifies the destination organization for writes.
61
+ org my-org
62
+ </match>
63
+ ```
64
+
65
+ ##### Full configuration
66
+
67
+ ```
68
+ <match influxdb2.**>
69
+ @type influxdb2
70
+
71
+ # InfluxDB URL to connect to (ex. https://localhost:9999).
72
+ url https://localhost:9999
73
+ # Access Token used for authenticating/authorizing the InfluxDB request sent by client.
74
+ token my-token
75
+ # Turn on/off SSL for HTTP communication.
76
+ use_ssl true
77
+
78
+ # Specifies the destination bucket for writes.
79
+ bucket my-bucket
80
+ # Specifies the destination organization for writes.
81
+ org my-org
82
+
83
+ # The name of the measurement. If not specified, Fluentd's tag is used.
84
+ measurement h2o
85
+ # The list of record keys that are stored in InfluxDB as 'tag'.
86
+ tag_keys ["location", "type"]
87
+ # Specifies if the Fluentd's event tag is included into InfluxDB tags (ex. 'fluentd=system.logs).'
88
+ tag_fluentd true
89
+
90
+ # The list of record keys that are stored in InfluxDB as 'field'.
91
+ # If it's not specified than as fields are used all record keys.
92
+ field_keys ["value"]
93
+ # Turn on/off auto casting Integer value to Float.
94
+ # Helper to avoid mismatch error: 'series type mismatch: already Integer but got Float'.
95
+ field_cast_to_float true
96
+
97
+ # The time precision of timestamp. You should specify either second (s), millisecond (ms),
98
+ # microsecond (us), or nanosecond (ns).
99
+ time_precision s
100
+ # A name of the record key that used as a 'timestamp' instead of event timestamp.
101
+ # If a record key doesn't exists or hasn't value then is used event timestamp.
102
+ time_key time
103
+ </match>
104
+ ```
105
+
106
+ ## Contributing
107
+
108
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bonitoo-io/influxdb-plugin-fluent.
109
+
110
+ ## License
111
+
112
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,37 @@
1
+ # The MIT License
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'bundler/gem_tasks'
22
+ require 'rake/testtask'
23
+ require 'rubocop/rake_task'
24
+
25
+ Rake::TestTask.new(:test) do |t|
26
+ t.libs << 'test'
27
+ t.libs << 'lib'
28
+ t.test_files = FileList['test/**/*_test.rb']
29
+ end
30
+
31
+ task default: :test
32
+
33
+ # Rubocop
34
+ desc 'Run Rubocop lint checks'
35
+ task :rubocop do
36
+ RuboCop::RakeTask.new
37
+ end
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # The MIT License
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+ #
23
+
24
+ set -e
25
+
26
+ echo "Wait to start InfluxDB 2.0"
27
+ wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:9999/metrics
28
+
29
+ echo
30
+ echo "Post onBoarding request, to setup initial user (my-user@my-password), org (my-org) and bucketSetup (my-bucket)"
31
+ echo
32
+ curl -i -X POST http://localhost:9999/api/v2/setup -H 'accept: application/json' \
33
+ -d '{
34
+ "username": "my-user",
35
+ "password": "my-password",
36
+ "org": "my-org",
37
+ "bucket": "my-bucket",
38
+ "token": "my-token"
39
+ }'