fluent-plugin-burrow 1.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
  SHA1:
3
- metadata.gz: 39340b1b558d45c2bc90b371d73d33dd0fa4d26c
4
- data.tar.gz: ac0f5ce4759eba67450f13bb07a023f304becd69
3
+ metadata.gz: 79b17469b72f5d09f0bc84ef8471a934cba254db
4
+ data.tar.gz: c91601ac6a9d7f8368aa39e79d7f12cf26418d9b
5
5
  SHA512:
6
- metadata.gz: d547faabd129b91df6a46f5f9145933fd40f9c4cebdb460094992057368814ba3e5354e7c3a2132272bb043bad9ae7d5e61c1a128eff20dcd9ca7a70b346d5b7
7
- data.tar.gz: cb4bdfff79da208322ffd2890ddb04c217ae2ddbd8821ad76959eb44d2ad71473834bc3acec18aaef088b11c1069add50ad7321ce59708e2d784060205042bf3
6
+ metadata.gz: 8bec4b6f3f963915ad55ac28cbc20143ea346d442bc22402cb513ca2b5a40cc4b03c5619c9afc7edf03eb25690f505cb1b63455b51c8db921f3bbe596b5120c0
7
+ data.tar.gz: 423673c8e99d563a7b3ebdf49d4e389597b195d42167ab03180ed59f60d83af7dc6f9d00ad07a67849638c77fde68dfef5cd6d8811c3d3f6f68b5e0e757ce349
data/README.md CHANGED
@@ -157,6 +157,37 @@ instead of 'inplace', the resulting record would have been:
157
157
  }
158
158
  ```
159
159
 
160
+ - prefix
161
+
162
+ Insert the decoded data in the original record, using the `data_prefix` key. In our example above, if 'prefix' was used
163
+ instead of 'inplace' with 'data_prefix' = 'data', the resulting record would have been:
164
+
165
+ ```
166
+ {
167
+ "host":"app1",
168
+ "ident":"5012162",
169
+ "data": {
170
+ "event":"csrf_failure",
171
+ "msg":"Invalid transient key for System.",
172
+ "username":"System",
173
+ "userid":"1",
174
+ "ip":"192.34.93.74",
175
+ "method":"GET",
176
+ "domain":"http://timgunter.ca",
177
+ "path":"/dashboard/settings",
178
+ "tags":["csrf","failure"],
179
+ "accountid":5009392,
180
+ "siteid":5012162
181
+ }
182
+ }
183
+ ```
184
+
185
+ ### data_prefix
186
+
187
+ `required` if you use 'action' = 'prefix' (defaults to `nil`)
188
+
189
+ The prefix used to insert the decoded data in the message.
190
+
160
191
  ### keep_key
161
192
 
162
193
  `optional` and defaults to `false`
@@ -4,7 +4,7 @@ $:.push File.expand_path("../lib", __FILE__)
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-burrow"
6
6
  s.description = "Extract a single key (in formats Fluent can natively understand) from an event and re-emit a new event that replaces the entire original record with that key's values."
7
- s.version = "1.0"
7
+ s.version = "1.1"
8
8
  s.license = "MIT"
9
9
  s.authors = ["Tim Gunter"]
10
10
  s.email = ["tim@vanillaforums.com"]
@@ -18,4 +18,4 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_development_dependency "rake"
20
20
  s.add_runtime_dependency "fluentd"
21
- end
21
+ end
@@ -14,6 +14,7 @@ class Fluent::BurrowPlugin < Fluent::Output
14
14
  config_param :format, :string
15
15
 
16
16
  # Optional - tag format
17
+ config_param :data_prefix, :string, :default => nil # The prefix used for the existing data
17
18
  config_param :tag, :string, :default => nil # Create a new tag for the re-emitted event
18
19
  config_param :remove_prefix, :string, :default => nil # Remove a prefix from the existing tag
19
20
  config_param :add_prefix, :string, :default => nil # Add a prefix to the existing tag
@@ -50,7 +51,7 @@ class Fluent::BurrowPlugin < Fluent::Output
50
51
  end
51
52
 
52
53
  # Validate action
53
- actions = ['replace','overlay','inplace']
54
+ actions = ['replace','overlay','inplace','prefix']
54
55
  if not actions.include? @action
55
56
  raise Fluent::ConfigError, "Invalid 'action', must be one of #{actions.join(',')}"
56
57
  end
@@ -59,6 +60,9 @@ class Fluent::BurrowPlugin < Fluent::Output
59
60
  if @action == 'inplace' and @keep_key
60
61
  raise Fluent::ConfigError, "Specifying 'keep_key' with action 'inplace' is not supported"
61
62
  end
63
+ if @action == 'prefix' and not @data_prefix
64
+ raise Fluent::ConfigError, "You must specify 'data_prefix' with action 'prefix'"
65
+ end
62
66
 
63
67
  # Prepare fluent's built-in parser
64
68
  @parser = Fluent::TextParser.new()
@@ -118,10 +122,13 @@ class Fluent::BurrowPlugin < Fluent::Output
118
122
  r = record.merge(r)
119
123
  when 'replace'
120
124
  # noop
125
+ when 'prefix'
126
+ r = record.merge({@data_prefix => r})
121
127
  end
122
128
 
123
- if ['overlay','replace'].include? @action
124
- if not @keep_key
129
+ # Keep the key?
130
+ if ['overlay','replace','prefix'].include? @action
131
+ if not @keep_key and not r.nil? and r.has_key?(@key_name)
125
132
  r.delete(@key_name)
126
133
  end
127
134
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-burrow
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Gunter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
11
+ date: 2015-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake