fluent-plugin-vmware-loginsight 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2585e4aea973a9cd5070714c36bbb98a0c9ea039ab65aaae92d07a6b88fa773f
4
- data.tar.gz: 8726b2ab9f414a9acb79b18d74f989cd3a3017b4fec255cfcc495df848e5aa65
3
+ metadata.gz: 8f0ed8fee9ccfe49ebb1ba72c051649f66ddcadb5efac2478f0c47c5138ba9bd
4
+ data.tar.gz: 8ce497a63cb0b54abdb6d3b993f43733e76d7cc835c5d1b70aaec24f54899aba
5
5
  SHA512:
6
- metadata.gz: 79830b33a50d080964123b4d61f9d9943876960c4a4afc6ef97da3442d50cbb1bfe941106e9c10284f9552c4a7c527a076574e0ebccab2bae6e9d2ccdd33ca16
7
- data.tar.gz: 055ed0fcee328c8faa8748490630460aae2c8c596eaf319b3a816880a222edfddb2666df4cfd2f113432f42d191dc6b3cad100fa3e4e696fab8f8703fb0daf30
6
+ metadata.gz: 24e31e9ae6b324513deede287efdded411c2352c934f027d0ee1c1c7e3e1f4c3858967a9b33fb2419c81d4f5b4a6a5f1e9e275d7cc8e89dce96bf751a4aa275b
7
+ data.tar.gz: 2ac6b44914a33c75f6e37c0332d60a10a59ba1f706e2dc252edcaa918e814be9cebc779b359b03188620e557958e26181877a0858293c094f4bf924f1e249c98
data/README.md CHANGED
@@ -113,6 +113,10 @@ include_tag_key, :bool, :default => true :: Valid Value: true | false
113
113
  # Metadata key that identifies Fluentd tags
114
114
  tag_key, :string, :default => 'tag'
115
115
 
116
+ # Keys from log event whose values should be added as log message/text
117
+ # to loginsight. Note these key/value pairs won't be added as metadata/fields
118
+ log_text_keys, :array, :default => ["log", "message", "msg"] :: Valid Value: Array of strings
119
+
116
120
  # Flatten hashes to create one key/val pair w/o losing log data
117
121
  flatten_hashes, :bool, :default => true :: Valid Value: true | false
118
122
 
@@ -14,7 +14,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
14
14
 
15
15
  Gem::Specification.new do |spec|
16
16
  spec.name = "fluent-plugin-vmware-loginsight"
17
- spec.version = "0.1.3"
17
+ spec.version = "0.1.4"
18
18
  spec.authors = ["Vishal Mohite", "Chris Todd"]
19
19
  spec.email = ["vmohite@vmware.com", "toddc@vmware.com"]
20
20
 
@@ -62,6 +62,9 @@ module Fluent
62
62
  config_param :include_tag_key, :bool, :default => true
63
63
  # Metadata key that identifies Fluentd tags
64
64
  config_param :tag_key, :string, :default => 'tag'
65
+ # Keys from log event whose values should be added as log message/text
66
+ # to loginsight. Note these key/value pairs won't be added as metadata/fields
67
+ config_param :log_text_keys, :array, default: ["log", "message", "msg"], value_type: :string
65
68
  # Flatten hashes to create one key/val pair w/o losing log data
66
69
  config_param :flatten_hashes, :bool, :default => true
67
70
  # Seperator to use for joining flattened keys
@@ -131,6 +134,8 @@ module Fluent
131
134
  flattened_records = {}
132
135
  if @flatten_hashes
133
136
  flattened_records = flatten_record(record, [])
137
+ else
138
+ flattened_records = record
134
139
  end
135
140
  flattened_records[@tag_key] = tag if @include_tag_key
136
141
  fields = []
@@ -146,8 +151,9 @@ module Fluent
146
151
  end
147
152
  keys.push(key)
148
153
  key.force_encoding("utf-8")
149
- # convert value to string if needed
154
+ # convert value to json string if its a hash and to string if not already a string
150
155
  begin
156
+ value = value.to_json if value.is_a?(Hash)
151
157
  value = value.to_s if not value.instance_of?(String)
152
158
  value.force_encoding("utf-8")
153
159
  rescue Exception=>e
@@ -156,7 +162,7 @@ module Fluent
156
162
  value = "Exception during conversion: #{e.message}"
157
163
  end
158
164
  end
159
- if ['log', 'message', 'msg'].include?(key)
165
+ if @log_text_keys.include?(key)
160
166
  if log != "#{value}"
161
167
  if log.empty?
162
168
  log = "#{value}"
@@ -189,9 +195,13 @@ module Fluent
189
195
 
190
196
  case record
191
197
  when Hash
192
- record.each { |key, value|
193
- ret.merge! flatten_record(value, prefix + [key.to_s])
194
- }
198
+ record.each do |key, value|
199
+ if @log_text_keys.include?(key)
200
+ ret.merge!({key.to_s => value})
201
+ else
202
+ ret.merge! flatten_record(value, prefix + [key.to_s])
203
+ end
204
+ end
195
205
  when Array
196
206
  # Don't mess with arrays, leave them unprocessed
197
207
  ret.merge!({prefix.join(@flatten_hashes_separator) => record})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-vmware-loginsight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vishal Mohite
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-09-13 00:00:00.000000000 Z
12
+ date: 2018-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler