logstash-input-s3-local 3.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 70f42ae79bda3f07c5291a65b98c590916fb002536a9429fca2135262b74e9ae
4
+ data.tar.gz: e6837e138ced50f8651524227f8cd4a7a661be9d52a82663a116baf90d7f7628
5
+ SHA512:
6
+ metadata.gz: 3189abb3131b2313a0142abf39ab8e75f292037d3472769f8460031a8fd45e4226e174182a31f6077beccdae3994d9b8d1398a3c3de72f45507ecfe1d436072a
7
+ data.tar.gz: 2d2319e0076092fc76660fb9e3fe653009ea940dd8b009455a2c9589ad601564074e18e990388f952270bb64f10fc849799f8467f802e4b536f8ed873e7b957f
data/CHANGELOG.md ADDED
@@ -0,0 +1,77 @@
1
+ ## 3.3.5
2
+ - [#136](https://github.com/logstash-plugins/logstash-input-s3/pull/136) Avoid plugin crashes when encountering 'bad' files in S3 buckets
3
+
4
+ ## 3.3.4
5
+ - Log entry when bucket is empty #150
6
+
7
+ ## 3.3.3
8
+ - Symbolize hash keys for additional_settings hash #148
9
+
10
+ ## 3.3.2
11
+ - Docs: Set the default_codec doc attribute.
12
+
13
+ ## 3.3.1
14
+ - Improve error handling when listing/downloading from S3 #144
15
+
16
+ ## 3.3.0
17
+ - Add documentation for endpoint, role_arn and role_session_name #142
18
+ - Add support for additional_settings option #141
19
+
20
+ ## 3.2.0
21
+ - Add support for auto-detecting gzip files with `.gzip` extension, in addition to existing support for `*.gz`
22
+ - Improve performance of gzip decoding by 10x by using Java's Zlib
23
+
24
+ ## 3.1.9
25
+ - Change default sincedb path to live in `{path.data}/plugins/inputs/s3` instead of $HOME.
26
+ Prior Logstash installations (using $HOME default) are automatically migrated.
27
+ - Don't download the file if the length is 0 #2
28
+
29
+ ## 3.1.8
30
+ - Update gemspec summary
31
+
32
+ ## 3.1.7
33
+ - Fix missing last multi-line entry #120
34
+
35
+ ## 3.1.6
36
+ - Fix some documentation issues
37
+
38
+ ## 3.1.4
39
+ - Avoid parsing non string elements #109
40
+
41
+ ## 3.1.3
42
+ - The plugin will now include the s3 key in the metadata #105
43
+
44
+ ## 3.1.2
45
+ - Fix an issue when the remote file contains multiple blob of gz in the same file #101
46
+ - Make the integration suite run
47
+ - Remove uneeded development dependency
48
+
49
+ ## 3.1.1
50
+ - Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99
51
+
52
+ ## 3.1.0
53
+ - breaking,config: Remove deprecated config `credentials` and `region_endpoint`. Please use AWS mixin.
54
+
55
+ ## 3.0.1
56
+ - Republish all the gems under jruby.
57
+
58
+ ## 3.0.0
59
+ - Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
60
+
61
+ ## 2.0.6
62
+ - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
63
+
64
+ ## 2.0.5
65
+ - New dependency requirements for logstash-core for the 5.0 release
66
+
67
+ ## 2.0.4
68
+ - Fix for Error: No Such Key problem when deleting
69
+
70
+ ## 2.0.3
71
+ - Do not raise an exception if the sincedb file is empty, instead return the current time #66
72
+
73
+ ## 2.0.0
74
+ - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
75
+ instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
76
+ - Dependency on logstash-core update to 2.0
77
+
data/CONTRIBUTORS ADDED
@@ -0,0 +1,19 @@
1
+ The following is a list of people who have contributed ideas, code, bug
2
+ reports, or in general have helped logstash along its way.
3
+
4
+ Contributors:
5
+ * Aaron Mildenstein (untergeek)
6
+ * Adam Tucker (adamjt)
7
+ * John Pariseau (ururk)
8
+ * Jordan Sissel (jordansissel)
9
+ * Mathieu Guillaume (mguillaume)
10
+ * Pier-Hugues Pellerin (ph)
11
+ * Richard Pijnenburg (electrical)
12
+ * Suyog Rao (suyograo)
13
+ * Ted Timmons (tedder)
14
+ * Ryan O'Keeffe (danielredoak)
15
+
16
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
17
+ Logstash, and you aren't on the list above and want to be, please let us know
18
+ and we'll make sure you're here. Contributions from folks like you are what make
19
+ open source awesome.
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
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
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012-2018 Elasticsearch <http://www.elastic.co>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/NOTICE.TXT ADDED
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
data/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Logstash Plugin
2
+
3
+ [![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-input-s3.svg)](https://travis-ci.org/logstash-plugins/logstash-input-s3)
4
+
5
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
6
+
7
+ It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
8
+
9
+ ## Required S3 Permissions
10
+
11
+ This plugin reads from your S3 bucket, and would require the following
12
+ permissions applied to the AWS IAM Policy being used:
13
+
14
+ * `s3:ListBucket` to check if the S3 bucket exists and list objects in it.
15
+ * `s3:GetObject` to check object metadata and download objects from S3 buckets.
16
+
17
+ You might also need `s3:DeleteObject` when setting S3 input to delete on read.
18
+ And the `s3:CreateBucket` permission to create a backup bucket unless already
19
+ exists.
20
+ In addition, when `backup_to_bucket` is used, the `s3:PutObject` action is also required.
21
+
22
+ For buckets that have versioning enabled, you might need to add additional
23
+ permissions.
24
+
25
+ More information about S3 permissions can be found at -
26
+ http://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html
27
+
28
+ ## Documentation
29
+
30
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
31
+
32
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
33
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
34
+
35
+ ## Need Help?
36
+
37
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
38
+
39
+ ## Developing
40
+
41
+ ### 1. Plugin Developement and Testing
42
+
43
+ #### Code
44
+ - To get started, you'll need JRuby with the Bundler gem installed.
45
+
46
+ - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
47
+
48
+ - Install dependencies
49
+ ```sh
50
+ bundle install
51
+ ```
52
+
53
+ #### Test
54
+
55
+ - Update your dependencies
56
+
57
+ ```sh
58
+ bundle install
59
+ ```
60
+
61
+ - Run tests
62
+
63
+ ```sh
64
+ bundle exec rspec
65
+ ```
66
+
67
+ ### 2. Running your unpublished Plugin in Logstash
68
+
69
+ #### 2.1 Run in a local Logstash clone
70
+
71
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
72
+ ```ruby
73
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
74
+ ```
75
+ - Install plugin
76
+ ```sh
77
+ # Logstash 2.3 and higher
78
+ bin/logstash-plugin install --no-verify
79
+
80
+ # Prior to Logstash 2.3
81
+ bin/plugin install --no-verify
82
+
83
+ ```
84
+ - Run Logstash with your plugin
85
+ ```sh
86
+ bin/logstash -e 'filter {awesome {}}'
87
+ ```
88
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
89
+
90
+ #### 2.2 Run in an installed Logstash
91
+
92
+ You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
93
+
94
+ - Build your plugin gem
95
+ ```sh
96
+ gem build logstash-filter-awesome.gemspec
97
+ ```
98
+ - Install the plugin from the Logstash home
99
+ ```sh
100
+ # Logstash 2.3 and higher
101
+ bin/logstash-plugin install --no-verify
102
+
103
+ # Prior to Logstash 2.3
104
+ bin/plugin install --no-verify
105
+
106
+ ```
107
+ - Start Logstash and proceed to test the plugin
108
+
109
+ ## Contributing
110
+
111
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
112
+
113
+ Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
114
+
115
+ It is more important to the community that you are able to contribute.
116
+
117
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -0,0 +1,271 @@
1
+ :plugin: s3
2
+ :type: input
3
+ :default_codec: plain
4
+
5
+ ///////////////////////////////////////////
6
+ START - GENERATED VARIABLES, DO NOT EDIT!
7
+ ///////////////////////////////////////////
8
+ :version: %VERSION%
9
+ :release_date: %RELEASE_DATE%
10
+ :changelog_url: %CHANGELOG_URL%
11
+ :include_path: ../../../../logstash/docs/include
12
+ ///////////////////////////////////////////
13
+ END - GENERATED VARIABLES, DO NOT EDIT!
14
+ ///////////////////////////////////////////
15
+
16
+ [id="plugins-{type}s-{plugin}"]
17
+
18
+ === S3 input plugin
19
+
20
+ include::{include_path}/plugin_header.asciidoc[]
21
+
22
+ ==== Description
23
+
24
+ Stream events from files from a S3 bucket.
25
+
26
+ Each line from each file generates an event.
27
+ Files ending in `.gz` are handled as gzip'ed files.
28
+
29
+ [id="plugins-{type}s-{plugin}-options"]
30
+ ==== S3 Input Configuration Options
31
+
32
+ This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
33
+
34
+ [cols="<,<,<",options="header",]
35
+ |=======================================================================
36
+ |Setting |Input type|Required
37
+ | <<plugins-{type}s-{plugin}-access_key_id>> |<<string,string>>|No
38
+ | <<plugins-{type}s-{plugin}-additional_settings>> |<<hash,hash>>|No
39
+ | <<plugins-{type}s-{plugin}-aws_credentials_file>> |<<string,string>>|No
40
+ | <<plugins-{type}s-{plugin}-backup_add_prefix>> |<<string,string>>|No
41
+ | <<plugins-{type}s-{plugin}-backup_to_bucket>> |<<string,string>>|No
42
+ | <<plugins-{type}s-{plugin}-backup_to_dir>> |<<string,string>>|No
43
+ | <<plugins-{type}s-{plugin}-bucket>> |<<string,string>>|Yes
44
+ | <<plugins-{type}s-{plugin}-delete>> |<<boolean,boolean>>|No
45
+ | <<plugins-{type}s-{plugin}-endpoint>> |<<string,string>>|No
46
+ | <<plugins-{type}s-{plugin}-exclude_pattern>> |<<string,string>>|No
47
+ | <<plugins-{type}s-{plugin}-interval>> |<<number,number>>|No
48
+ | <<plugins-{type}s-{plugin}-prefix>> |<<string,string>>|No
49
+ | <<plugins-{type}s-{plugin}-proxy_uri>> |<<string,string>>|No
50
+ | <<plugins-{type}s-{plugin}-region>> |<<string,string>>|No
51
+ | <<plugins-{type}s-{plugin}-role_arn>> |<<string,string>>|No
52
+ | <<plugins-{type}s-{plugin}-role_session_name>> |<<string,string>>|No
53
+ | <<plugins-{type}s-{plugin}-secret_access_key>> |<<string,string>>|No
54
+ | <<plugins-{type}s-{plugin}-session_token>> |<<string,string>>|No
55
+ | <<plugins-{type}s-{plugin}-sincedb_path>> |<<string,string>>|No
56
+ | <<plugins-{type}s-{plugin}-temporary_directory>> |<<string,string>>|No
57
+ |=======================================================================
58
+
59
+ Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
60
+ input plugins.
61
+
62
+ &nbsp;
63
+
64
+ [id="plugins-{type}s-{plugin}-access_key_id"]
65
+ ===== `access_key_id`
66
+
67
+ * Value type is <<string,string>>
68
+ * There is no default value for this setting.
69
+
70
+ This plugin uses the AWS SDK and supports several ways to get credentials, which will be tried in this order:
71
+
72
+ 1. Static configuration, using `access_key_id` and `secret_access_key` params in logstash plugin config
73
+ 2. External credentials file specified by `aws_credentials_file`
74
+ 3. Environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
75
+ 4. Environment variables `AMAZON_ACCESS_KEY_ID` and `AMAZON_SECRET_ACCESS_KEY`
76
+ 5. IAM Instance Profile (available when running inside EC2)
77
+
78
+ [id="plugins-{type}s-{plugin}-aws_credentials_file"]
79
+ ===== `aws_credentials_file`
80
+
81
+ * Value type is <<string,string>>
82
+ * There is no default value for this setting.
83
+
84
+ Path to YAML file containing a hash of AWS credentials.
85
+ This file will only be loaded if `access_key_id` and
86
+ `secret_access_key` aren't set. The contents of the
87
+ file should look like this:
88
+
89
+ [source,ruby]
90
+ ----------------------------------
91
+ :access_key_id: "12345"
92
+ :secret_access_key: "54321"
93
+ ----------------------------------
94
+
95
+
96
+ [id="plugins-{type}s-{plugin}-backup_add_prefix"]
97
+ ===== `backup_add_prefix`
98
+
99
+ * Value type is <<string,string>>
100
+ * Default value is `nil`
101
+
102
+ Append a prefix to the key (full path including file name in s3) after processing.
103
+ If backing up to another (or the same) bucket, this effectively lets you
104
+ choose a new 'folder' to place the files in
105
+
106
+ [id="plugins-{type}s-{plugin}-backup_to_bucket"]
107
+ ===== `backup_to_bucket`
108
+
109
+ * Value type is <<string,string>>
110
+ * Default value is `nil`
111
+
112
+ Name of a S3 bucket to backup processed files to.
113
+
114
+ [id="plugins-{type}s-{plugin}-backup_to_dir"]
115
+ ===== `backup_to_dir`
116
+
117
+ * Value type is <<string,string>>
118
+ * Default value is `nil`
119
+
120
+ Path of a local directory to backup processed files to.
121
+
122
+ [id="plugins-{type}s-{plugin}-bucket"]
123
+ ===== `bucket`
124
+
125
+ * This is a required setting.
126
+ * Value type is <<string,string>>
127
+ * There is no default value for this setting.
128
+
129
+ The name of the S3 bucket.
130
+
131
+ [id="plugins-{type}s-{plugin}-delete"]
132
+ ===== `delete`
133
+
134
+ * Value type is <<boolean,boolean>>
135
+ * Default value is `false`
136
+
137
+ Whether to delete processed files from the original bucket.
138
+
139
+ [id="plugins-{type}s-{plugin}-endpoint"]
140
+ ===== `endpoint`
141
+
142
+ * Value type is <<string,string>>
143
+ * There is no default value for this setting.
144
+
145
+ The endpoint to connect to. By default it is constructed using the value of `region`.
146
+ This is useful when connecting to S3 compatible services, but beware that these aren't
147
+ guaranteed to work correctly with the AWS SDK.
148
+
149
+ [id="plugins-{type}s-{plugin}-exclude_pattern"]
150
+ ===== `exclude_pattern`
151
+
152
+ * Value type is <<string,string>>
153
+ * Default value is `nil`
154
+
155
+ Ruby style regexp of keys to exclude from the bucket
156
+
157
+ [id="plugins-{type}s-{plugin}-additional_settings"]
158
+ ===== `additional_settings`
159
+
160
+ * Value type is <<hash,hash>>
161
+ * Default value is `{}`
162
+
163
+ Key-value pairs of settings and corresponding values used to parametrize
164
+ the connection to s3. See full list in https://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Client.html[the AWS SDK documentation]. Example:
165
+
166
+ [source,ruby]
167
+ input {
168
+ s3 {
169
+ "access_key_id" => "1234",
170
+ "secret_access_key" => "secret",
171
+ "bucket" => "logstash-test",
172
+ "additional_settings" => {
173
+ "force_path_style" => true,
174
+ "follow_redirects" => false
175
+ }
176
+ }
177
+ }
178
+
179
+ [id="plugins-{type}s-{plugin}-interval"]
180
+ ===== `interval`
181
+
182
+ * Value type is <<number,number>>
183
+ * Default value is `60`
184
+
185
+ Interval to wait between to check the file list again after a run is finished.
186
+ Value is in seconds.
187
+
188
+ [id="plugins-{type}s-{plugin}-prefix"]
189
+ ===== `prefix`
190
+
191
+ * Value type is <<string,string>>
192
+ * Default value is `nil`
193
+
194
+ If specified, the prefix of filenames in the bucket must match (not a regexp)
195
+
196
+ [id="plugins-{type}s-{plugin}-proxy_uri"]
197
+ ===== `proxy_uri`
198
+
199
+ * Value type is <<string,string>>
200
+ * There is no default value for this setting.
201
+
202
+ URI to proxy server if required
203
+
204
+ [id="plugins-{type}s-{plugin}-region"]
205
+ ===== `region`
206
+
207
+ * Value type is <<string,string>>
208
+ * Default value is `"us-east-1"`
209
+
210
+ The AWS Region
211
+
212
+ [id="plugins-{type}s-{plugin}-role_arn"]
213
+ ===== `role_arn`
214
+
215
+ * Value type is <<string,string>>
216
+ * There is no default value for this setting.
217
+
218
+ The AWS IAM Role to assume, if any.
219
+ This is used to generate temporary credentials, typically for cross-account access.
220
+ See the https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html[AssumeRole API documentation] for more information.
221
+
222
+ [id="plugins-{type}s-{plugin}-role_session_name"]
223
+ ===== `role_session_name`
224
+
225
+ * Value type is <<string,string>>
226
+ * Default value is `"logstash"`
227
+
228
+ Session name to use when assuming an IAM role.
229
+
230
+ [id="plugins-{type}s-{plugin}-secret_access_key"]
231
+ ===== `secret_access_key`
232
+
233
+ * Value type is <<string,string>>
234
+ * There is no default value for this setting.
235
+
236
+ The AWS Secret Access Key
237
+
238
+ [id="plugins-{type}s-{plugin}-session_token"]
239
+ ===== `session_token`
240
+
241
+ * Value type is <<string,string>>
242
+ * There is no default value for this setting.
243
+
244
+ The AWS Session token for temporary credential
245
+
246
+ [id="plugins-{type}s-{plugin}-sincedb_path"]
247
+ ===== `sincedb_path`
248
+
249
+ * Value type is <<string,string>>
250
+ * Default value is `nil`
251
+
252
+ Where to write the since database (keeps track of the date
253
+ the last handled file was added to S3). The default will write
254
+ sincedb files to in the directory '{path.data}/plugins/inputs/s3/'
255
+
256
+ If specified, this setting must be a filename path and not just a directory.
257
+
258
+ [id="plugins-{type}s-{plugin}-temporary_directory"]
259
+ ===== `temporary_directory`
260
+
261
+ * Value type is <<string,string>>
262
+ * Default value is `"/tmp/logstash"`
263
+
264
+ Set the directory where logstash will store the tmp files before processing them.
265
+
266
+
267
+
268
+ [id="plugins-{type}s-{plugin}-common-options"]
269
+ include::{include_path}/{type}.asciidoc[]
270
+
271
+ :default_codec!:
@@ -0,0 +1,20 @@
1
+ # This is patch related to the autoloading and ruby
2
+ #
3
+ # The fix exist in jruby 9k but not in the current jruby, not sure when or it will be backported
4
+ # https://github.com/jruby/jruby/issues/3645
5
+ #
6
+ # AWS is doing tricky name discovery in the module to generate the correct error class and
7
+ # this strategy is bogus in jruby and `eager_autoload` don't fix this issue.
8
+ #
9
+ # This will be a short lived patch since AWS is removing the need.
10
+ # see: https://github.com/aws/aws-sdk-ruby/issues/1301#issuecomment-261115960
11
+ old_stderr = $stderr
12
+
13
+ $stderr = StringIO.new
14
+ begin
15
+ module Aws
16
+ const_set(:S3, Aws::S3)
17
+ end
18
+ ensure
19
+ $stderr = old_stderr
20
+ end