logstash-filter-elasticsearch 3.1.1 → 3.1.3

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
  SHA1:
3
- metadata.gz: fca76ef931de7a0a36ebe8a10c0797fbea7d5a40
4
- data.tar.gz: 6d54f667037cc1376c2991b29e81ae08bbd86e56
3
+ metadata.gz: 2d8d89ca168ed0ebf323797e15f3fccdc42f25e8
4
+ data.tar.gz: 088c46969a6855d284b4a343ed81379d5600bc33
5
5
  SHA512:
6
- metadata.gz: 208ffd629273a862f53b702fe4f7ad19c979e79e2d7519c02e8324472497bf529e8fa988e21100d63a2ed4aa5b0d5328e397318a8f088ff343eeb49e278744bb
7
- data.tar.gz: e4b94567c7d54ac8c4f3a26ed9ce0730261f1827f1beb08492362a0f570244d858f90b1483cd0601b1f2aade5eed6cd8354bb2c333ec15f8e1a140b0aeace352
6
+ metadata.gz: 23c8a2066af25344e1e4f4226bb07583175a1b5566ebb342d97704dbd77f21fcc1a688edb23d49d2a1c9df7a946d04ecbe5c930f3463759cd1d4a4a829ecf4f3
7
+ data.tar.gz: 901f9323aed42e79b60a9fd10798372babe2ec439fbb2808456172b1dc22fae198310ce887eb5f0cb22e449f687adb41e3d54709f5352b38e50c4ba5c61fa039
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.1.3
2
+ - Change the queries loglevel from info to debug.
3
+
4
+ ## 3.1.2
5
+ - Docs: Add requirement to use version 3.1.1 or higher to support sending Content-Type headers.
6
+
1
7
  ## 3.1.1
2
8
  - Upgrade es-ruby client to support correct content-type
3
9
 
data/CONTRIBUTORS CHANGED
@@ -8,6 +8,7 @@ Contributors:
8
8
  * Pier-Hugues Pellerin (ph)
9
9
  * Richard Pijnenburg (electrical)
10
10
  * Suyog Rao (suyograo)
11
+ * Adrian Solom (addrians)
11
12
 
12
13
  Note: If you've sent us patches, bug reports, or otherwise contributed to
13
14
  Logstash, and you aren't on the list above and want to be, please let us know
@@ -0,0 +1,236 @@
1
+ :plugin: elasticsearch
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
+ === Elasticsearch
18
+
19
+ include::{include_path}/plugin_header.asciidoc[]
20
+
21
+ ==== Description
22
+
23
+ .Compatibility Note
24
+ [NOTE]
25
+ ================================================================================
26
+ Starting with Elasticsearch 5.3, there's an {ref}modules-http.html[HTTP setting]
27
+ called `http.content_type.required`. If this option is set to `true`, and you
28
+ are using Logstash 2.4 through 5.2, you need to update the Elasticsearch filter
29
+ plugin to version 3.1.1 or higher.
30
+
31
+ ================================================================================
32
+
33
+ Search Elasticsearch for a previous log event and copy some fields from it
34
+ into the current event. Below are two complete examples of how this filter might
35
+ be used.
36
+
37
+ The first example uses the legacy 'query' parameter where the user is limited to an Elasticsearch query_string.
38
+ Whenever logstash receives an "end" event, it uses this elasticsearch
39
+ filter to find the matching "start" event based on some operation identifier.
40
+ Then it copies the `@timestamp` field from the "start" event into a new field on
41
+ the "end" event. Finally, using a combination of the "date" filter and the
42
+ "ruby" filter, we calculate the time duration in hours between the two events.
43
+ [source,ruby]
44
+ --------------------------------------------------
45
+ if [type] == "end" {
46
+ elasticsearch {
47
+ hosts => ["es-server"]
48
+ query => "type:start AND operation:%{[opid]}"
49
+ fields => { "@timestamp" => "started" }
50
+ }
51
+
52
+ date {
53
+ match => ["[started]", "ISO8601"]
54
+ target => "[started]"
55
+ }
56
+
57
+ ruby {
58
+ code => "event['duration_hrs'] = (event['@timestamp'] - event['started']) / 3600 rescue nil"
59
+ }
60
+ }
61
+
62
+ The example below reproduces the above example but utilises the query_template. This query_template represents a full
63
+ Elasticsearch query DSL and supports the standard Logstash field substitution syntax. The example below issues
64
+ the same query as the first example but uses the template shown.
65
+
66
+ if [type] == "end" {
67
+ elasticsearch {
68
+ hosts => ["es-server"]
69
+ query_template => "template.json"
70
+ }
71
+
72
+ date {
73
+ match => ["[started]", "ISO8601"]
74
+ target => "[started]"
75
+ }
76
+
77
+ ruby {
78
+ code => "event['duration_hrs'] = (event['@timestamp'] - event['started']) / 3600 rescue nil"
79
+ }
80
+ }
81
+
82
+
83
+
84
+ template.json:
85
+
86
+ {
87
+ "query": {
88
+ "query_string": {
89
+ "query": "type:start AND operation:%{[opid]}"
90
+ }
91
+ },
92
+ "_source": ["@timestamp", "started"]
93
+ }
94
+
95
+ As illustrated above, through the use of 'opid', fields from the Logstash events can be referenced within the template.
96
+ The template will be populated per event prior to being used to query Elasticsearch.
97
+
98
+ --------------------------------------------------
99
+
100
+ [id="plugins-{type}s-{plugin}-options"]
101
+ ==== Elasticsearch Filter Configuration Options
102
+
103
+ This plugin supports the following configuration options plus the <<plugins-{type}s-common-options>> described later.
104
+
105
+ [cols="<,<,<",options="header",]
106
+ |=======================================================================
107
+ |Setting |Input type|Required
108
+ | <<plugins-{type}s-{plugin}-ca_file>> |a valid filesystem path|No
109
+ | <<plugins-{type}s-{plugin}-enable_sort>> |<<boolean,boolean>>|No
110
+ | <<plugins-{type}s-{plugin}-fields>> |<<array,array>>|No
111
+ | <<plugins-{type}s-{plugin}-hosts>> |<<array,array>>|No
112
+ | <<plugins-{type}s-{plugin}-index>> |<<string,string>>|No
113
+ | <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
114
+ | <<plugins-{type}s-{plugin}-query>> |<<string,string>>|No
115
+ | <<plugins-{type}s-{plugin}-query_template>> |<<string,string>>|No
116
+ | <<plugins-{type}s-{plugin}-result_size>> |<<number,number>>|No
117
+ | <<plugins-{type}s-{plugin}-sort>> |<<string,string>>|No
118
+ | <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|No
119
+ | <<plugins-{type}s-{plugin}-tag_on_failure>> |<<array,array>>|No
120
+ | <<plugins-{type}s-{plugin}-user>> |<<string,string>>|No
121
+ |=======================================================================
122
+
123
+ Also see <<plugins-{type}s-common-options>> for a list of options supported by all
124
+ filter plugins.
125
+
126
+ &nbsp;
127
+
128
+ [id="plugins-{type}s-{plugin}-ca_file"]
129
+ ===== `ca_file`
130
+
131
+ * Value type is <<path,path>>
132
+ * There is no default value for this setting.
133
+
134
+ SSL Certificate Authority file
135
+
136
+ [id="plugins-{type}s-{plugin}-enable_sort"]
137
+ ===== `enable_sort`
138
+
139
+ * Value type is <<boolean,boolean>>
140
+ * Default value is `true`
141
+
142
+ Whether results should be sorted or not
143
+
144
+ [id="plugins-{type}s-{plugin}-fields"]
145
+ ===== `fields`
146
+
147
+ * Value type is <<array,array>>
148
+ * Default value is `{}`
149
+
150
+ Array of fields to copy from old event (found via elasticsearch) into new event
151
+
152
+ [id="plugins-{type}s-{plugin}-hosts"]
153
+ ===== `hosts`
154
+
155
+ * Value type is <<array,array>>
156
+ * Default value is `["localhost:9200"]`
157
+
158
+ List of elasticsearch hosts to use for querying.
159
+
160
+ [id="plugins-{type}s-{plugin}-index"]
161
+ ===== `index`
162
+
163
+ * Value type is <<string,string>>
164
+ * Default value is `""`
165
+
166
+ Comma-delimited list of index names to search; use `_all` or empty string to perform the operation on all indices
167
+
168
+ [id="plugins-{type}s-{plugin}-password"]
169
+ ===== `password`
170
+
171
+ * Value type is <<password,password>>
172
+ * There is no default value for this setting.
173
+
174
+ Basic Auth - password
175
+
176
+ [id="plugins-{type}s-{plugin}-query"]
177
+ ===== `query`
178
+
179
+ * Value type is <<string,string>>
180
+ * There is no default value for this setting.
181
+
182
+ Elasticsearch query string. Read the Elasticsearch query string documentation.
183
+ for more info at: https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-query-string-query.html#query-string-syntax
184
+
185
+ [id="plugins-{type}s-{plugin}-query_template"]
186
+ ===== `query_template`
187
+
188
+ * Value type is <<string,string>>
189
+ * There is no default value for this setting.
190
+
191
+ File path to elasticsearch query in DSL format. Read the Elasticsearch query documentation
192
+ for more info at: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html
193
+
194
+ [id="plugins-{type}s-{plugin}-result_size"]
195
+ ===== `result_size`
196
+
197
+ * Value type is <<number,number>>
198
+ * Default value is `1`
199
+
200
+ How many results to return
201
+
202
+ [id="plugins-{type}s-{plugin}-sort"]
203
+ ===== `sort`
204
+
205
+ * Value type is <<string,string>>
206
+ * Default value is `"@timestamp:desc"`
207
+
208
+ Comma-delimited list of `<field>:<direction>` pairs that define the sort order
209
+
210
+ [id="plugins-{type}s-{plugin}-ssl"]
211
+ ===== `ssl`
212
+
213
+ * Value type is <<boolean,boolean>>
214
+ * Default value is `false`
215
+
216
+ SSL
217
+
218
+ [id="plugins-{type}s-{plugin}-tag_on_failure"]
219
+ ===== `tag_on_failure`
220
+
221
+ * Value type is <<array,array>>
222
+ * Default value is `["_elasticsearch_lookup_failure"]`
223
+
224
+ Tags the event on failure to look up geo information. This can be used in later analysis.
225
+
226
+ [id="plugins-{type}s-{plugin}-user"]
227
+ ===== `user`
228
+
229
+ * Value type is <<string,string>>
230
+ * There is no default value for this setting.
231
+
232
+ Basic Auth - username
233
+
234
+
235
+
236
+ include::{include_path}/{type}.asciidoc[]
@@ -4,6 +4,16 @@ require "logstash/namespace"
4
4
  require_relative "elasticsearch/client"
5
5
  require "logstash/json"
6
6
 
7
+ # .Compatibility Note
8
+ # [NOTE]
9
+ # ================================================================================
10
+ # Starting with Elasticsearch 5.3, there's an {ref}modules-http.html[HTTP setting]
11
+ # called `http.content_type.required`. If this option is set to `true`, and you
12
+ # are using Logstash 2.4 through 5.2, you need to update the Elasticsearch filter
13
+ # plugin to version 3.1.1 or higher.
14
+ #
15
+ # ================================================================================
16
+ #
7
17
  # Search Elasticsearch for a previous log event and copy some fields from it
8
18
  # into the current event. Below are two complete examples of how this filter might
9
19
  # be used.
@@ -150,7 +160,7 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
150
160
  params[:sort] = @sort if @enable_sort
151
161
  end
152
162
 
153
- @logger.info("Querying elasticsearch for lookup", :params => params)
163
+ @logger.debug("Querying elasticsearch for lookup", :params => params)
154
164
 
155
165
  results = @client.search(params)
156
166
  @fields.each do |old_key, new_key|
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-elasticsearch'
4
- s.version = '3.1.1'
4
+ s.version = '3.1.3'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Search elasticsearch for a previous log event and copy some fields from it into the current event"
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-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-07 00:00:00.000000000 Z
11
+ date: 2017-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -76,6 +76,7 @@ files:
76
76
  - LICENSE
77
77
  - NOTICE.TXT
78
78
  - README.md
79
+ - docs/index.asciidoc
79
80
  - lib/logstash/filters/elasticsearch.rb
80
81
  - lib/logstash/filters/elasticsearch/client.rb
81
82
  - logstash-filter-elasticsearch.gemspec