logstash-filter-translate 3.0.1 → 3.0.2

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: a88523429ce3660b177179da29ca3817bbe0e4fd
4
- data.tar.gz: 69e3b1a02058d4876b2b2e8a3104f5d346ed81d0
3
+ metadata.gz: f24578265064ba7eff335775a45c53a788f7ae95
4
+ data.tar.gz: 9f3402bad245470bcbe6fd96556710b3232205d6
5
5
  SHA512:
6
- metadata.gz: 27cccb3185892156caac4e68bbbaa044837284505d33f0ca1b42b4a1b7bef478cda2927b86f03f4c1e62cafe6fc768050a9d8a2ce6a8bc11e70281ecb89eee57
7
- data.tar.gz: 2938b6b48d5dc0159d9fe4236849b84bb8fcdf3878cf487324785881c503ca9d680b33375121cb6188ceb9fde515604e9e50f90b2d1d38ab3b65367ded3f788e
6
+ metadata.gz: 4fe297db163c1a1bf1b07ea3a0024539ca9e09fbd5fc728523ffb6fd79c59904ba16805a7cc38dfdf8ae74f31fe0ee05a2d563034daf81f353d14e06ee241a0e
7
+ data.tar.gz: 472bdd70f2a8290c4678ac1c03f544a127453ca008f85217600dc21b6e62cc13c0686bab3cc949d437ad1fece576ad19a776023b38c15876c4bd44862e914a47
data/Gemfile CHANGED
@@ -1,2 +1,11 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
2
+
3
+ gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
@@ -0,0 +1,211 @@
1
+ :plugin: translate
2
+ :type: filter
3
+
4
+ ///////////////////////////////////////////
5
+ START - GENERATED VARIABLES, DO NOT EDIT!
6
+ ///////////////////////////////////////////
7
+ :version: %VERSION%
8
+ :release_date: %RELEASE_DATE%
9
+ :changelog_url: %CHANGELOG_URL%
10
+ :include_path: ../../../../logstash/docs/include
11
+ ///////////////////////////////////////////
12
+ END - GENERATED VARIABLES, DO NOT EDIT!
13
+ ///////////////////////////////////////////
14
+
15
+ [id="plugins-{type}-{plugin}"]
16
+
17
+ === Translate filter plugin
18
+
19
+ include::{include_path}/plugin_header.asciidoc[]
20
+
21
+ ==== Description
22
+
23
+ A general search and replace tool that uses a configured hash
24
+ and/or a file to determine replacement values. Currently supported are
25
+ YAML, JSON, and CSV files.
26
+
27
+ The dictionary entries can be specified in one of two ways: First,
28
+ the `dictionary` configuration item may contain a hash representing
29
+ the mapping. Second, an external file (readable by logstash) may be specified
30
+ in the `dictionary_path` configuration item. These two methods may not be used
31
+ in conjunction; it will produce an error.
32
+
33
+ Operationally, if the event field specified in the `field` configuration
34
+ matches the EXACT contents of a dictionary entry key (or matches a regex if
35
+ `regex` configuration item has been enabled), the field's value will be substituted
36
+ with the matched key's value from the dictionary.
37
+
38
+ By default, the translate filter will replace the contents of the
39
+ maching event field (in-place). However, by using the `destination`
40
+ configuration item, you may also specify a target event field to
41
+ populate with the new translated value.
42
+
43
+ Alternatively, for simple string search and replacements for just a few values
44
+ you might consider using the gsub function of the mutate filter.
45
+
46
+ [id="plugins-{type}s-{plugin}-options"]
47
+ ==== Translate Filter Configuration Options
48
+
49
+ This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
50
+
51
+ [cols="<,<,<",options="header",]
52
+ |=======================================================================
53
+ |Setting |Input type|Required
54
+ | <<plugins-{type}s-{plugin}-destination>> |<<string,string>>|No
55
+ | <<plugins-{type}s-{plugin}-dictionary>> |<<hash,hash>>|No
56
+ | <<plugins-{type}s-{plugin}-dictionary_path>> |a valid filesystem path|No
57
+ | <<plugins-{type}s-{plugin}-exact>> |<<boolean,boolean>>|No
58
+ | <<plugins-{type}s-{plugin}-fallback>> |<<string,string>>|No
59
+ | <<plugins-{type}s-{plugin}-field>> |<<string,string>>|Yes
60
+ | <<plugins-{type}s-{plugin}-override>> |<<boolean,boolean>>|No
61
+ | <<plugins-{type}s-{plugin}-refresh_interval>> |<<number,number>>|No
62
+ | <<plugins-{type}s-{plugin}-regex>> |<<boolean,boolean>>|No
63
+ |=======================================================================
64
+
65
+ Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
66
+ filter plugins.
67
+
68
+ &nbsp;
69
+
70
+ [id="plugins-{type}s-{plugin}-destination"]
71
+ ===== `destination`
72
+
73
+ * Value type is <<string,string>>
74
+ * Default value is `"translation"`
75
+
76
+ The destination field you wish to populate with the translated code. The default
77
+ is a field named `translation`. Set this to the same value as source if you want
78
+ to do a substitution, in this case filter will allways succeed. This will clobber
79
+ the old value of the source field!
80
+
81
+ [id="plugins-{type}s-{plugin}-dictionary"]
82
+ ===== `dictionary`
83
+
84
+ * Value type is <<hash,hash>>
85
+ * Default value is `{}`
86
+
87
+ The dictionary to use for translation, when specified in the logstash filter
88
+ configuration item (i.e. do not use the `@dictionary_path` file).
89
+
90
+ Example:
91
+ [source,ruby]
92
+ filter {
93
+ translate {
94
+ dictionary => [ "100", "Continue",
95
+ "101", "Switching Protocols",
96
+ "merci", "thank you",
97
+ "old version", "new version" ]
98
+ }
99
+ }
100
+
101
+ NOTE: It is an error to specify both `dictionary` and `dictionary_path`.
102
+
103
+ [id="plugins-{type}s-{plugin}-dictionary_path"]
104
+ ===== `dictionary_path`
105
+
106
+ * Value type is <<path,path>>
107
+ * There is no default value for this setting.
108
+
109
+ The full path of the external dictionary file. The format of the table
110
+ should be a standard YAML, JSON, or CSV. Make sure you specify any integer-based keys
111
+ in quotes. For example, the YAML file should look something like this:
112
+ [source,ruby]
113
+ "100": Continue
114
+ "101": Switching Protocols
115
+ merci: gracias
116
+ old version: new version
117
+
118
+ NOTE: it is an error to specify both `dictionary` and `dictionary_path`.
119
+
120
+ The currently supported formats are YAML, JSON, and CSV. Format selection is
121
+ based on the file extension: `json` for JSON, `yaml` or `yml` for YAML, and
122
+ `csv` for CSV. The JSON format only supports simple key/value, unnested
123
+ objects. The CSV format expects exactly two columns, with the first serving
124
+ as the original text, and the second column as the replacement.
125
+
126
+ [id="plugins-{type}s-{plugin}-exact"]
127
+ ===== `exact`
128
+
129
+ * Value type is <<boolean,boolean>>
130
+ * Default value is `true`
131
+
132
+ When `exact => true`, the translate filter will populate the destination field
133
+ with the exact contents of the dictionary value. When `exact => false`, the
134
+ filter will populate the destination field with the result of any existing
135
+ destination field's data, with the translated value substituted in-place.
136
+
137
+ For example, consider this simple translation.yml, configured to check the `data` field:
138
+ [source,ruby]
139
+ foo: bar
140
+
141
+ If logstash receives an event with the `data` field set to `foo`, and `exact => true`,
142
+ the destination field will be populated with the string `bar`.
143
+ If `exact => false`, and logstash receives the same event, the destination field
144
+ will be also set to `bar`. However, if logstash receives an event with the `data` field
145
+ set to `foofing`, the destination field will be set to `barfing`.
146
+
147
+ Set both `exact => true` AND `regex => `true` if you would like to match using dictionary
148
+ keys as regular expressions. A large dictionary could be expensive to match in this case.
149
+
150
+ [id="plugins-{type}s-{plugin}-fallback"]
151
+ ===== `fallback`
152
+
153
+ * Value type is <<string,string>>
154
+ * There is no default value for this setting.
155
+
156
+ In case no translation occurs in the event (no matches), this will add a default
157
+ translation string, which will always populate `field`, if the match failed.
158
+
159
+ For example, if we have configured `fallback => "no match"`, using this dictionary:
160
+ [source,ruby]
161
+ foo: bar
162
+
163
+ Then, if logstash received an event with the field `foo` set to `bar`, the destination
164
+ field would be set to `bar`. However, if logstash received an event with `foo` set to `nope`,
165
+ then the destination field would still be populated, but with the value of `no match`.
166
+ This configuration can be dynamic and include parts of the event using the `%{field}` syntax.
167
+
168
+ [id="plugins-{type}s-{plugin}-field"]
169
+ ===== `field`
170
+
171
+ * This is a required setting.
172
+ * Value type is <<string,string>>
173
+ * There is no default value for this setting.
174
+
175
+ The name of the logstash event field containing the value to be compared for a
176
+ match by the translate filter (e.g. `message`, `host`, `response_code`).
177
+
178
+ If this field is an array, only the first value will be used.
179
+
180
+ [id="plugins-{type}s-{plugin}-override"]
181
+ ===== `override`
182
+
183
+ * Value type is <<boolean,boolean>>
184
+ * Default value is `false`
185
+
186
+ If the destination (or target) field already exists, this configuration item specifies
187
+ whether the filter should skip translation (default) or overwrite the target field
188
+ value with the new translation value.
189
+
190
+ [id="plugins-{type}s-{plugin}-refresh_interval"]
191
+ ===== `refresh_interval`
192
+
193
+ * Value type is <<number,number>>
194
+ * Default value is `300`
195
+
196
+ When using a dictionary file, this setting will indicate how frequently
197
+ (in seconds) logstash will check the dictionary file for updates.
198
+
199
+ [id="plugins-{type}s-{plugin}-regex"]
200
+ ===== `regex`
201
+
202
+ * Value type is <<boolean,boolean>>
203
+ * Default value is `false`
204
+
205
+ If you'd like to treat dictionary keys as regular expressions, set `exact => true`.
206
+ Note: this is activated only when `exact => true`.
207
+
208
+
209
+
210
+ [id="plugins-{type}s-{plugin}-common-options"]
211
+ include::{include_path}/{type}.asciidoc[]
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-translate'
4
- s.version = '3.0.1'
4
+ s.version = '3.0.2'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "A general search and replace tool which uses a configured hash and/or a YAML file to determine replacement values."
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
14
+ s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-26 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -56,6 +56,7 @@ files:
56
56
  - LICENSE
57
57
  - NOTICE.TXT
58
58
  - README.md
59
+ - docs/index.asciidoc
59
60
  - lib/logstash/filters/translate.rb
60
61
  - logstash-filter-translate.gemspec
61
62
  - spec/filters/translate_spec.rb