fluent-plugin-influxdb-deduplication 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aac38463aad973daa8abf8f04c51c51e3654be687c70fbfa4d2ded133075fe0d
4
- data.tar.gz: 5fff6893e6240e861740968e45754665f50484e44ac08ea37f93d472381b4c6f
3
+ metadata.gz: e2c3760445648631a72cd9fa02f5f18ec0391b3e5e9172f49448a62dc5cc895e
4
+ data.tar.gz: c354954939bc6e3209a71e173e34e796a0073bf345276701ad0aba386dd3a662
5
5
  SHA512:
6
- metadata.gz: 91b7f1f3c930937daeec8811bddb31f3e5e5718de6842fa57d7243534455cf8570835035017749ee22f1fea2ecef7c228deb08e8a47a4a2a74b5bfb1e6be6821
7
- data.tar.gz: 5efdea5ff2243289eb2b73420f6bedae059d0b5157f2d6711f16f781f48cf8935dfd12c9a54c36f937c93ac8f4f724e23db4b1078a936864d4ea9221d6ae7921
6
+ metadata.gz: e7e54a5bc97b6ba35b29582fb1ac4487fa486c2503c3b0f174591dd522c9ab124678350fe87c5fbecedd3c17da5ee85ed9231a5c04fb365a7293b4eec151ce11
7
+ data.tar.gz: 0d0e5c0853ffdf0f661f23102fe6e6ef5ce71087d3ffc1897353df4ed03fcb96def70a9040812d030ea616c6034bd590c5d23f56e07fd368f5404ec5366d4c2a
@@ -0,0 +1,14 @@
1
+ name: test
2
+ on:
3
+ - push
4
+ - pull_request
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - uses: ruby/setup-ruby@v1
11
+ with:
12
+ ruby-version: 2.6
13
+ bundler-cache: true
14
+ - run: bundle exec rake test
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Marc Adams
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,2 +1,86 @@
1
- # Deduplication records for [Fluentd](http://fluentd.org) with a influxdb output plugin
1
+ # [Fluentd](https://www.fluentd.org/) filter plugin to deduplicate records for InfluxDB
2
2
 
3
+ A filter plugin that implements the deduplication techniques described in the [InfluxDB doc](https://docs.influxdata.com/influxdb/v2.0/write-data/best-practices/duplicate-points/).
4
+
5
+
6
+ ## Installation
7
+
8
+ Using RubyGems:
9
+
10
+ ```
11
+ fluent-gem install fluent-plugin-influxdb-deduplication
12
+ ```
13
+
14
+
15
+ ## Configuration
16
+
17
+ ### Deduplicate by incrementing the timestamp
18
+
19
+ The filter plugin reads the fluentd record event time with a precision to the second, and stores it in the `time_key` field.
20
+ Any following record with the same timestamp has a `time_key` incremented by 1 nanosecond.
21
+
22
+ <filter pattern>
23
+ @type influxdb_deduplication
24
+
25
+ # field to store the deduplicated timestamp
26
+ time_key my_key_field
27
+ </filter>
28
+
29
+ For example, the following input records:
30
+
31
+ 1613910640 { "k1" => 0, "k2" => "value0" }
32
+ 1613910640 { "k1" => 1, "k2" => "value1" }
33
+ 1613910640 { "k1" => 2, "k2" => "value2" }
34
+ 1613910641 { "k1" => 3, "k3" => "value3" }
35
+
36
+ Would create on output:
37
+
38
+ 1613910640 { "k1" => 0, "k2" => "value0", "my_key_field" => 1613910640000000000 }
39
+ 1613910640 { "k1" => 1, "k2" => "value1", "my_key_field" => 1613910640000000001 }
40
+ 1613910640 { "k1" => 2, "k2" => "value2", "my_key_field" => 1613910640000000002 }
41
+ 1613910641 { "k1" => 3, "k3" => "value3", "my_key_field" => 1613910643000000000 }
42
+
43
+ The time key field can then be passed as is to the [fluent-plugin-influxdb-v2](https://github.com/influxdata/influxdb-plugin-fluent).
44
+ Example configuration on nginx logs:
45
+
46
+ <filter nginx.access>
47
+ @type influxdb_deduplication
48
+
49
+ # field to store the deduplicated timestamp
50
+ time_key my_key_field
51
+ </filter>
52
+
53
+ <match nginx.access>
54
+ @type influxdb2
55
+
56
+ # setup the access to your InfluxDB v2 instance
57
+ url https://localhost:8086
58
+ token my-token
59
+ bucket my-bucket
60
+ org my-org
61
+
62
+ # the influxdb2 timekey must be set to the same value as the influxdb_deduplication time_key
63
+ time_key my_key_field
64
+
65
+ # the timestamp precision must be set to ns
66
+ time_precision ns
67
+
68
+ tag_keys ["request_method", "status"]
69
+ field_keys ["remote_addr", "request_uri"]
70
+ </match>
71
+
72
+ The data can then be queried as a table and viewed in [Grafana](https://grafana.com/) for example with the flux query:
73
+
74
+ from(bucket: "my-bucket")
75
+ |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
76
+ |> pivot(
77
+ rowKey:["_time"],
78
+ columnKey: ["_field"],
79
+ valueColumn: "_value"
80
+ )
81
+ |> keep(columns: ["_time", "request_method", "status", "remote_addr", "request_uri"])
82
+
83
+
84
+ ### Deduplicate by adding a sequence tag
85
+
86
+ TODO
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -4,6 +4,7 @@ $:.push File.expand_path('../lib', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "fluent-plugin-influxdb-deduplication"
6
6
  gem.description = "Filter plugin for deduplicating records for influxdb"
7
+ gem.homepage = "https://github.com/marcadamsge/fluent-plugin-influxdb-deduplication"
7
8
  gem.summary = gem.description
8
9
  gem.version = File.read("VERSION").strip
9
10
  gem.authors = ["Marc Adams"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-influxdb-deduplication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Adams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-23 00:00:00.000000000 Z
11
+ date: 2021-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -64,15 +64,17 @@ executables: []
64
64
  extensions: []
65
65
  extra_rdoc_files: []
66
66
  files:
67
+ - ".github/workflows/test.yml"
67
68
  - ChangeLog
68
69
  - Gemfile
70
+ - LICENSE
69
71
  - README.md
70
72
  - Rakefile
71
73
  - VERSION
72
74
  - fluent-plugin-influxdb-deduplication.gemspec
73
75
  - lib/fluent/plugin/filter_influxdb_deduplication.rb
74
76
  - test/test_filter_influxdb_deduplication.rb
75
- homepage:
77
+ homepage: https://github.com/marcadamsge/fluent-plugin-influxdb-deduplication
76
78
  licenses:
77
79
  - MIT
78
80
  metadata: {}