fluent-plugin-cmetrics 0.1.0.rc8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/fluent-plugin-cmetrics.gemspec +1 -1
- data/lib/fluent/plugin/formatter_cmetrics_splunk_metric_payload.rb +14 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24fd1261db862a55b33f49932214689ec9b65bdcd8aa0c3287993f21bba26943
|
4
|
+
data.tar.gz: c264c77b3be6894a9a36a5053b142ed8b27fb3fc89c6b2de74b36bc6ec407d01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0db025054c9c808875e29612dba17abccdb6fc6f3337cd41f2b68a2c6429b3133eb07cd8a4fb3e0a38f532a70f0c241bc597675f1767057db6fa8ca40f3d548
|
7
|
+
data.tar.gz: fa1764de2e06cc32c2d880366b98d3912224500e7214cd3cb75231813c09515b865279ec7e9a0ea639638968e1c624df2efec7c5706678c0f175a8719d63595e
|
data/README.md
CHANGED
@@ -110,6 +110,12 @@ Specify splunk source name
|
|
110
110
|
|
111
111
|
Specify splunk sourcetype name
|
112
112
|
|
113
|
+
### only_use_last_field_keys (bool) (optional)
|
114
|
+
|
115
|
+
Whether using only last key values or not when processing for field keys
|
116
|
+
|
117
|
+
Default value: `false`
|
118
|
+
|
113
119
|
### \<fields\> section (optional) (single)
|
114
120
|
|
115
121
|
This secsion is used for adding extra fields as dimensions into cmetrics msgpack Splunk metric payload.
|
@@ -44,8 +44,10 @@ module Fluent
|
|
44
44
|
config_param :source, :string, default: nil
|
45
45
|
desc "Specify splunk sourcetype name"
|
46
46
|
config_param :sourcetype, :string, default: nil
|
47
|
-
|
48
|
-
|
47
|
+
desc "Whether using only last key values or not when processing for field keys"
|
48
|
+
config_param :only_use_last_field_keys, :bool, default: false
|
49
|
+
config_section :fields, init: false, multi: false, required: false do
|
50
|
+
# Other parameters nothing here. For later purpose.
|
49
51
|
end
|
50
52
|
|
51
53
|
def initialize
|
@@ -77,9 +79,6 @@ module Fluent
|
|
77
79
|
end
|
78
80
|
extra_fields = {}
|
79
81
|
|
80
|
-
@fields_accessors.each do |key, accessor|
|
81
|
-
extra_fields[key] = accessor.call(record)
|
82
|
-
end
|
83
82
|
payload = {
|
84
83
|
host: host,
|
85
84
|
# From the API reference
|
@@ -96,7 +95,16 @@ module Fluent
|
|
96
95
|
if dims = @cmetrics_dims_accessor.call(record)
|
97
96
|
fields.merge!(dims)
|
98
97
|
end
|
99
|
-
|
98
|
+
@fields_accessors.each do |key, accessor|
|
99
|
+
if record = accessor.call(record)
|
100
|
+
record.each do |k, v|
|
101
|
+
if @only_use_last_field_keys
|
102
|
+
extra_fields[k.split(".").last] = v
|
103
|
+
else
|
104
|
+
extra_fields[k] = v
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
100
108
|
fields.merge!(extra_fields)
|
101
109
|
end
|
102
110
|
payload.merge!(fields)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-cmetrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubygems_version: 3.2.22
|
127
127
|
signing_key:
|