fluent-plugin-kvp-filter 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 +4 -4
- data/.travis.yml +10 -4
- data/README.md +15 -1
- data/fluent-plugin-kvp-filter.gemspec +1 -1
- data/lib/fluent/plugin/filter_kvp.rb +13 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee0c4ecd171c5a6a84a174c6c3c986c466b4d67b
|
|
4
|
+
data.tar.gz: 1efc793df622f2cbbd0738da52a43546e2b842c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fed10c0a58c87e1ba103fbe6f48baed6fba86e6a684fc134b88f927665986fca30eff8ad914ffe7acb2d63c17dd90194afbae89a0eacb962a2a45a27fb0870db
|
|
7
|
+
data.tar.gz: 303aa8b85d78a0f724025bd4de604a5a025086468379194b1d22f9e4388ed3d33b3b4bb5f93f2265c0c02f8564641efa5ddffb658b1856cf9760ae754de82122
|
data/.travis.yml
CHANGED
|
@@ -5,13 +5,19 @@ rvm:
|
|
|
5
5
|
deploy:
|
|
6
6
|
provider: script
|
|
7
7
|
script: .travis/deploy.sh
|
|
8
|
-
# provider: rubygems
|
|
9
|
-
# api_key:
|
|
10
|
-
# secure: Nl+oGHjLKpqh6xizIS6KKD4NofFDx5nvCI1psCXg5KCBl1cZQ6mZwMeqJYonrW3NgCpDHgTG0uImiRg6bAmzE4KC5zja6aDZ3jFzWjOa84vnnvwkzRKxbVwuN+Au5+wUGZQUS6T8WROA+AHO/WNYmfHEOvP9qcb56AGzIM7qFL88hoTDGnnOUOs6WEIc5TLmAu6h+/YccEwWrYw+6DYJ9zgZpl7HeOZsMO9vLrq8ud/s3dub1syTlMx9xZ4cqNEvTpMIPNWGx1W35EDbXMcWLbE6KLPxdlfHwk9rY6Kv9qHMH0FROvuiW9uSf/OQiIrOb1+ym+TOWO5sKAGsbgWOdp7rakQ1n6dP1nt3qJJW67Omldv518u+2t2uIyK8I6N4A4+Uk8jMZOUOBdyA6chpa/0btUM0KqG9qeUYS/Z4P0KSo1nabVaLgrAeUbdhTUo+jl2bU0kXmOtnMxrJ3N1f6iTt3aDKjJvV7tC1qbGtsk0IMq9wGTccCbBiBMQnnHguQ/MXEmvSA6l93e9sr8RjWUuJF70xr3n4OYgnfcvekhNKoznukMI7XascM2iQYw6hlKE7sD3b9tyfbdlM45Ak2XaIjzqQlM4296K2/0Q4lzwM2ijqeN2UhNUJAol9/o5xNwxwd/kmPgvqRkD5CCdtRlfQfAPFp8X00rkSEjpTcuk=
|
|
11
|
-
# gemspec: fluent-plugin-kvp-filter.gemspec
|
|
12
8
|
on:
|
|
13
9
|
tags: true
|
|
14
10
|
repo: matt-deboer/fluent-plugin-kvp-filter
|
|
11
|
+
|
|
12
|
+
# deploy:
|
|
13
|
+
# provider: rubygems
|
|
14
|
+
# api_key:
|
|
15
|
+
# secure: Nl+oGHjLKpqh6xizIS6KKD4NofFDx5nvCI1psCXg5KCBl1cZQ6mZwMeqJYonrW3NgCpDHgTG0uImiRg6bAmzE4KC5zja6aDZ3jFzWjOa84vnnvwkzRKxbVwuN+Au5+wUGZQUS6T8WROA+AHO/WNYmfHEOvP9qcb56AGzIM7qFL88hoTDGnnOUOs6WEIc5TLmAu6h+/YccEwWrYw+6DYJ9zgZpl7HeOZsMO9vLrq8ud/s3dub1syTlMx9xZ4cqNEvTpMIPNWGx1W35EDbXMcWLbE6KLPxdlfHwk9rY6Kv9qHMH0FROvuiW9uSf/OQiIrOb1+ym+TOWO5sKAGsbgWOdp7rakQ1n6dP1nt3qJJW67Omldv518u+2t2uIyK8I6N4A4+Uk8jMZOUOBdyA6chpa/0btUM0KqG9qeUYS/Z4P0KSo1nabVaLgrAeUbdhTUo+jl2bU0kXmOtnMxrJ3N1f6iTt3aDKjJvV7tC1qbGtsk0IMq9wGTccCbBiBMQnnHguQ/MXEmvSA6l93e9sr8RjWUuJF70xr3n4OYgnfcvekhNKoznukMI7XascM2iQYw6hlKE7sD3b9tyfbdlM45Ak2XaIjzqQlM4296K2/0Q4lzwM2ijqeN2UhNUJAol9/o5xNwxwd/kmPgvqRkD5CCdtRlfQfAPFp8X00rkSEjpTcuk=
|
|
16
|
+
# gemspec: fluent-plugin-kvp-filter.gemspec
|
|
17
|
+
# on:
|
|
18
|
+
# tags: true
|
|
19
|
+
# repo: matt-deboer/fluent-plugin-kvp-filter
|
|
20
|
+
|
|
15
21
|
env:
|
|
16
22
|
global:
|
|
17
23
|
- secure: bDv6wW3RpvXJJlEkMXPpqRBdmU9lOhXMf+x9znF2jXu7BEJQAb8ZsVJCJCbz2iTGan5/GdThhW3kKDjZz8bGlQP6J8j3lJmeQyGp1CW3DQBvHnoYruoqFdeycfgrf1E32ce97yQtw9/GNkb8dLAl309M+gUwk6UPZNgC62qohzXhSDU1eAuPZ5ad/uZ3uYtfgTY7IWpTycMP0dSm8kVr9lJADshRCP2iKf7op/5r9EiL/VU/XhXMT+2FqhD9t/YfdQsJlXo4JWvSoStPWO+YC6+rZ+vO6ovWMMxD6HYBPZUZqF4/KQXtggduHjQs9ogidG6rkEvBGKg/EfqnmeAHw/auEr38H0PGDwkuT8go332w2TwxLWdonpdYdJ77xG8Z4Sq+pQNCQX0papHgg4vGuWUjcRFIPufUBcTTwUnbRj4Dum92Q1NkBy4bgF/ZE4W1tEmjWZxxXhz790q05tWQv7Ng4mbCsnboV0K0JmBDl8tNZ7OAzQFadmorBea/dLQQbQbB383vPpbSAEABXyIlIpzoZmWAqvjWTngyTGuOIFW1lNG9G0rf+XDkus1+j6sZZQ5c3BZOm/C2fmaf4rPbe3qAiSUM2zpantiCsdn4zzS7LznWYADIgPZ2BJ/6bwtQYH45VhR+R6aG87oxTNO7wm6Iw1pSePZnPKGyWF0NEuM=
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# fluent-plugin-kvp-filter [](https://travis-ci.org/matt-deboer/fluent-plugin-kvp-filter)
|
|
1
|
+
# fluent-plugin-kvp-filter [](https://travis-ci.org/matt-deboer/fluent-plugin-kvp-filter) [](https://badge.fury.io/rb/fluent-plugin-kvp-filter)
|
|
2
2
|
|
|
3
3
|
Fluent filter plugin for parsing key/value fields in records
|
|
4
4
|
based on <key>=<value> pattern.
|
|
@@ -62,6 +62,20 @@ For configuration
|
|
|
62
62
|
|
|
63
63
|
it will remove the key "log_message" after parsing/extracting key/value pairs from it.
|
|
64
64
|
|
|
65
|
+
### Parameter unmatched_key
|
|
66
|
+
|
|
67
|
+
For configuration
|
|
68
|
+
|
|
69
|
+
<filter pattern>
|
|
70
|
+
type fields_parser
|
|
71
|
+
|
|
72
|
+
parse_key log_message
|
|
73
|
+
unmatched_key _unmatched
|
|
74
|
+
</filter>
|
|
75
|
+
|
|
76
|
+
if any portion of "log_message" is not matched, it will be added to the record under "_unmatched"
|
|
77
|
+
|
|
78
|
+
|
|
65
79
|
### Parameter fields_key
|
|
66
80
|
|
|
67
81
|
Configuration
|
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
|
6
6
|
gem.description = "Fluent filter plugin for parsing key/value fields in records"
|
|
7
7
|
gem.homepage = "https://github.com/matt-deboer/fluent-plugin-kvp-filter"
|
|
8
8
|
gem.summary = gem.description
|
|
9
|
-
gem.version = %x[git describe --tags --always]
|
|
9
|
+
gem.version = %x[git describe --tags --always | sed 's/-[0-9]-.*/.pre/']
|
|
10
10
|
gem.authors = ["Matt DeBoer"]
|
|
11
11
|
gem.email = ["matt.deboer@gmail.com"]
|
|
12
12
|
gem.has_rdoc = false
|
|
@@ -11,8 +11,9 @@ module Fluent::Plugin
|
|
|
11
11
|
config_param :fields_key, :string, :default => nil
|
|
12
12
|
config_param :pattern, :string,
|
|
13
13
|
:default => %{([a-zA-Z_]\\w*)=((['"]).*?(\\3)|[\\w.@$%/+-]*)}
|
|
14
|
-
config_param :strict_key_value,
|
|
15
|
-
config_param :remove_parse_key,
|
|
14
|
+
config_param :strict_key_value, :bool, :default => false
|
|
15
|
+
config_param :remove_parse_key, :bool, :default => false
|
|
16
|
+
config_param :unmatched_key, :string, :default => nil
|
|
16
17
|
|
|
17
18
|
def configure(conf)
|
|
18
19
|
super
|
|
@@ -31,6 +32,7 @@ module Fluent::Plugin
|
|
|
31
32
|
parsed = Logfmt.parse(source)
|
|
32
33
|
target.merge!(parsed)
|
|
33
34
|
else
|
|
35
|
+
unmatched = source
|
|
34
36
|
source.scan(compiled_pattern) do |match|
|
|
35
37
|
(key, value, begining_quote, ending_quote) = match
|
|
36
38
|
next if key.nil?
|
|
@@ -39,6 +41,15 @@ module Fluent::Plugin
|
|
|
39
41
|
from_pos = begining_quote.to_s.length
|
|
40
42
|
to_pos = value.length - ending_quote.to_s.length - 1
|
|
41
43
|
target[key] = value[from_pos..to_pos]
|
|
44
|
+
unless unmatched_key.nil?
|
|
45
|
+
unmatched = unmatched.gsub("#{key}=#{value}", "")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
unless unmatched_key.nil?
|
|
49
|
+
unmatched = unmatched.strip
|
|
50
|
+
unless unmatched.empty?
|
|
51
|
+
target[unmatched_key] = unmatched
|
|
52
|
+
end
|
|
42
53
|
end
|
|
43
54
|
end
|
|
44
55
|
|