logstash-input-google_cloud_storage 0.9.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +7 -0
- data/CONTRIBUTORS +11 -0
- data/Gemfile +10 -0
- data/LICENSE +11 -0
- data/README.md +95 -0
- data/docs/configuration.asciidoc +112 -0
- data/docs/examples.asciidoc +84 -0
- data/docs/index.asciidoc +43 -0
- data/docs/metadata.asciidoc +20 -0
- data/docs/resources.asciidoc +6 -0
- data/lib/logstash-input-google_cloud_storage_jars.rb +38 -0
- data/lib/logstash/inputs/cloud_storage/blob_adapter.rb +92 -0
- data/lib/logstash/inputs/cloud_storage/blob_filter.rb +99 -0
- data/lib/logstash/inputs/cloud_storage/client.rb +87 -0
- data/lib/logstash/inputs/cloud_storage/file_reader.rb +59 -0
- data/lib/logstash/inputs/cloud_storage/processed_db.rb +53 -0
- data/lib/logstash/inputs/google_cloud_storage.rb +130 -0
- data/logstash-input-google_cloud_storage.gemspec +49 -0
- data/spec/fixtures/credentials.json +8 -0
- data/spec/fixtures/helloworld.log +2 -0
- data/spec/fixtures/helloworld.log.gz +0 -0
- data/spec/inputs/cloud_storage/blob_adapter_spec.rb +95 -0
- data/spec/inputs/cloud_storage/blob_filter_spec.rb +92 -0
- data/spec/inputs/cloud_storage/client_spec.rb +33 -0
- data/spec/inputs/cloud_storage/file_reader_spec.rb +76 -0
- data/spec/inputs/cloud_storage/processed_db_spec.rb +82 -0
- data/spec/inputs/google_cloud_storage_spec.rb +127 -0
- data/vendor/jar-dependencies/com/fasterxml/jackson/core/jackson-core/2.1.3/jackson-core-2.1.3.jar +0 -0
- data/vendor/jar-dependencies/com/google/api-client/google-api-client/1.23.0/google-api-client-1.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/api/api-common/1.5.0/api-common-1.5.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/api/gax-httpjson/0.40.0/gax-httpjson-0.40.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/api/gax/1.23.0/gax-1.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/api/grpc/proto-google-common-protos/1.7.0/proto-google-common-protos-1.7.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/api/grpc/proto-google-iam-v1/0.8.0/proto-google-iam-v1-0.8.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/apis/google-api-services-storage/v1-rev114-1.23.0/google-api-services-storage-v1-rev114-1.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/auth/google-auth-library-credentials/0.9.0/google-auth-library-credentials-0.9.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/auth/google-auth-library-oauth2-http/0.9.0/google-auth-library-oauth2-http-0.9.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/cloud/google-cloud-core-http/1.25.0/google-cloud-core-http-1.25.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/cloud/google-cloud-core/1.25.0/google-cloud-core-1.25.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/cloud/google-cloud-storage/1.25.0/google-cloud-storage-1.25.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar +0 -0
- data/vendor/jar-dependencies/com/google/code/gson/gson/2.7/gson-2.7.jar +0 -0
- data/vendor/jar-dependencies/com/google/errorprone/error_prone_annotations/2.2.0/error_prone_annotations-2.2.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/guava/guava-jdk5/17.0/guava-jdk5-17.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/guava/guava/20.0/guava-20.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/http-client/google-http-client-appengine/1.23.0/google-http-client-appengine-1.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/http-client/google-http-client-jackson/1.23.0/google-http-client-jackson-1.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/http-client/google-http-client-jackson2/1.23.0/google-http-client-jackson2-1.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/http-client/google-http-client/1.23.0/google-http-client-1.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/oauth-client/google-oauth-client/1.23.0/google-oauth-client-1.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/google/protobuf/protobuf-java-util/3.5.1/protobuf-java-util-3.5.1.jar +0 -0
- data/vendor/jar-dependencies/com/google/protobuf/protobuf-java/3.5.1/protobuf-java-3.5.1.jar +0 -0
- data/vendor/jar-dependencies/commons-codec/commons-codec/1.3/commons-codec-1.3.jar +0 -0
- data/vendor/jar-dependencies/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar +0 -0
- data/vendor/jar-dependencies/io/grpc/grpc-context/1.9.0/grpc-context-1.9.0.jar +0 -0
- data/vendor/jar-dependencies/io/opencensus/opencensus-api/0.11.1/opencensus-api-0.11.1.jar +0 -0
- data/vendor/jar-dependencies/io/opencensus/opencensus-contrib-http-util/0.11.1/opencensus-contrib-http-util-0.11.1.jar +0 -0
- data/vendor/jar-dependencies/joda-time/joda-time/2.9.2/joda-time-2.9.2.jar +0 -0
- data/vendor/jar-dependencies/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar +0 -0
- data/vendor/jar-dependencies/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar +0 -0
- data/vendor/jar-dependencies/org/codehaus/jackson/jackson-core-asl/1.9.11/jackson-core-asl-1.9.11.jar +0 -0
- data/vendor/jar-dependencies/org/threeten/threetenbp/1.3.3/threetenbp-1.3.3.jar +0 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3c14fcc815a37372caf1deb49133e231a58107cb6b4389af67407d1af20bdca1
|
4
|
+
data.tar.gz: c7457cb5c5e24166c788d8222ea8fe84c65ff5f68c48c34936dafa01f739d407
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b0be07f9543f6db508a0f29e63c1b03a191b892149eb1229f79221b909fb02601ed7dd0c429088d0bb081e459a693b15b5dfd94114b0b9ff514489736d2bf2d
|
7
|
+
data.tar.gz: 7d555d58756d2f735736a64dc5d4aca2d7f2a376fc62eaf10017695f2e39ccc06cae896f2939446ade623f01ac11dc7e087dcc3ea359707e87591fc28daff61e
|
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
2
|
+
|
3
|
+
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.
|
4
|
+
|
5
|
+
It is more important to the community that you are able to contribute.
|
6
|
+
|
7
|
+
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
data/CONTRIBUTORS
ADDED
@@ -0,0 +1,11 @@
|
|
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
|
+
* Google LLC.
|
6
|
+
* Joseph Lewis III - jlewisiii@google.com
|
7
|
+
|
8
|
+
Note: If you've sent us patches, bug reports, or otherwise contributed to
|
9
|
+
Logstash, and you aren't on the list above and want to be, please let us know
|
10
|
+
and we'll make sure you're here. Contributions from folks like you are what make
|
11
|
+
open source awesome.
|
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
gemspec
|
3
|
+
|
4
|
+
logstash_path = ENV['LOGSTASH_PATH'] || '../../logstash'
|
5
|
+
use_logstash_source = ENV['LOGSTASH_SOURCE'] && ENV['LOGSTASH_SOURCE'].to_s == '1'
|
6
|
+
|
7
|
+
if Dir.exist?(logstash_path) && use_logstash_source
|
8
|
+
gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
|
9
|
+
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
|
10
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
you may not use this file except in compliance with the License.
|
3
|
+
You may obtain a copy of the License at
|
4
|
+
|
5
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
See the License for the specific language governing permissions and
|
11
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Logstash Input Google Cloud Storage
|
2
|
+
|
3
|
+
Extracts events from files in a Google Cloud Storage bucket.
|
4
|
+
|
5
|
+
Example use-cases:
|
6
|
+
|
7
|
+
* Read https://cloud.google.com/stackdriver/[Stackdriver logs] from a Cloud Storage bucket into Elastic.
|
8
|
+
* Read gzipped logs from cold-storage into Elastic.
|
9
|
+
* Restore data from an Elastic dump.
|
10
|
+
* Extract data from Cloud Storage, transform it with Logstash and load it into BigQuery.
|
11
|
+
|
12
|
+
Note: While this project is partially maintained by Google, this is not an official Google product.
|
13
|
+
|
14
|
+
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.
|
15
|
+
|
16
|
+
## Documentation
|
17
|
+
|
18
|
+
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/).
|
19
|
+
|
20
|
+
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
21
|
+
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
|
22
|
+
|
23
|
+
## Need Help?
|
24
|
+
|
25
|
+
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
26
|
+
|
27
|
+
## Developing
|
28
|
+
|
29
|
+
### 1. Plugin Developement and Testing
|
30
|
+
|
31
|
+
#### Code
|
32
|
+
- To get started, you'll need JRuby with the Bundler gem installed.
|
33
|
+
|
34
|
+
- 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).
|
35
|
+
|
36
|
+
- Install dependencies
|
37
|
+
```sh
|
38
|
+
bundle install
|
39
|
+
```
|
40
|
+
|
41
|
+
#### Test
|
42
|
+
|
43
|
+
- Update your dependencies
|
44
|
+
|
45
|
+
```sh
|
46
|
+
bundle install
|
47
|
+
```
|
48
|
+
|
49
|
+
- Run tests
|
50
|
+
|
51
|
+
```sh
|
52
|
+
bundle exec rspec
|
53
|
+
```
|
54
|
+
|
55
|
+
### 2. Running your unpublished Plugin in Logstash
|
56
|
+
|
57
|
+
#### 2.1 Run in a local Logstash clone
|
58
|
+
|
59
|
+
- Edit Logstash `Gemfile` and add the local plugin path, for example:
|
60
|
+
```ruby
|
61
|
+
gem "logstash-input-google_cloud_storage", :path => "/your/local/logstash-input-google_cloud_storage"
|
62
|
+
```
|
63
|
+
- Install plugin
|
64
|
+
```sh
|
65
|
+
bin/logstash-plugin install --no-verify logstash-input-google_cloud_storage
|
66
|
+
```
|
67
|
+
- Run Logstash with your plugin
|
68
|
+
```sh
|
69
|
+
bin/logstash -e 'inpug {google_cloud_storage {}}'
|
70
|
+
```
|
71
|
+
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
|
72
|
+
|
73
|
+
#### 2.2 Run in an installed Logstash
|
74
|
+
|
75
|
+
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:
|
76
|
+
|
77
|
+
- Build your plugin gem
|
78
|
+
```sh
|
79
|
+
gem build logstash-input-google_cloud_storage.gemspec
|
80
|
+
```
|
81
|
+
- Install the plugin from the Logstash home
|
82
|
+
```sh
|
83
|
+
bin/logstash-plugin install /your/local/plugin/logstash-input-google_cloud_storage.gem
|
84
|
+
```
|
85
|
+
- Start Logstash and proceed to test the plugin
|
86
|
+
|
87
|
+
## Contributing
|
88
|
+
|
89
|
+
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
90
|
+
|
91
|
+
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.
|
92
|
+
|
93
|
+
It is more important to the community that you are able to contribute.
|
94
|
+
|
95
|
+
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
@@ -0,0 +1,112 @@
|
|
1
|
+
[id="plugins-{type}s-{plugin}-options"]
|
2
|
+
==== Google Cloud Storage Input Configuration Options
|
3
|
+
|
4
|
+
This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
|
5
|
+
|
6
|
+
[cols="<,<,<",options="header",]
|
7
|
+
|=======================================================================
|
8
|
+
|Setting |Input type|Required
|
9
|
+
| <<plugins-{type}s-{plugin}-bucket_id>> |<<string,string>>|Yes
|
10
|
+
| <<plugins-{type}s-{plugin}-json_key_file>> |<<path,path>>|No
|
11
|
+
| <<plugins-{type}s-{plugin}-interval>> |<<number,number>>|No
|
12
|
+
| <<plugins-{type}s-{plugin}-file_matches>> |<<string,string>>|No
|
13
|
+
| <<plugins-{type}s-{plugin}-file_exclude>> |<<string,string>>|No
|
14
|
+
| <<plugins-{type}s-{plugin}-metadata_key>> |<<string,string>>|No
|
15
|
+
| <<plugins-{type}s-{plugin}-processed_db_path>> |<<path,path>>|No
|
16
|
+
| <<plugins-{type}s-{plugin}-delete>> |<<boolean,boolean>>|No
|
17
|
+
| <<plugins-{type}s-{plugin}-unpack_gzip>> |<<boolean,boolean>>|No
|
18
|
+
|=======================================================================
|
19
|
+
|
20
|
+
Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
|
21
|
+
input plugins.
|
22
|
+
|
23
|
+
|
24
|
+
[id="plugins-{type}s-{plugin}-bucket_id"]
|
25
|
+
===== `bucket_id`
|
26
|
+
|
27
|
+
* Value type is <<string,string>>
|
28
|
+
* There is no default value for this setting.
|
29
|
+
|
30
|
+
The bucket containing your log files.
|
31
|
+
|
32
|
+
[id="plugins-{type}s-{plugin}-json_key_file"]
|
33
|
+
===== `json_key_file`
|
34
|
+
|
35
|
+
* Value type is <<path,path>>
|
36
|
+
* There is no default value for this setting.
|
37
|
+
|
38
|
+
The path to the key to authenticate your user to the bucket.
|
39
|
+
This service user _should_ have the `storage.objects.update` permission so it can
|
40
|
+
create metadata on the object preventing it from being scanned multiple times.
|
41
|
+
|
42
|
+
[id="plugins-{type}s-{plugin}-interval"]
|
43
|
+
===== `interval`
|
44
|
+
|
45
|
+
* Value type is <<number,number>>
|
46
|
+
* Default is: `60`
|
47
|
+
|
48
|
+
The number of seconds between looking for new files in your bucket.
|
49
|
+
|
50
|
+
[id="plugins-{type}s-{plugin}-file_matches"]
|
51
|
+
===== `file_matches`
|
52
|
+
|
53
|
+
* Value type is <<string,string>>
|
54
|
+
* Default is: `.*\.log(\.gz)?`
|
55
|
+
|
56
|
+
A regex pattern to filter files. Only files with names matching this will be considered.
|
57
|
+
All files match by default.
|
58
|
+
|
59
|
+
[id="plugins-{type}s-{plugin}-file_exclude"]
|
60
|
+
===== `file_exclude`
|
61
|
+
|
62
|
+
* Value type is <<string,string>>
|
63
|
+
* Default is: `^$`
|
64
|
+
|
65
|
+
Any files matching this regex are excluded from processing.
|
66
|
+
No files are excluded by default.
|
67
|
+
|
68
|
+
[id="plugins-{type}s-{plugin}-metadata_key"]
|
69
|
+
===== `metadata_key`
|
70
|
+
|
71
|
+
* Value type is <<string,string>>
|
72
|
+
* Default is: `x-goog-meta-ls-gcs-input`
|
73
|
+
|
74
|
+
This key will be set on the objects after they've been processed by the plugin. That way you can
|
75
|
+
stop the plugin and not upload files again or prevent them from being uploaded by setting the
|
76
|
+
field manually.
|
77
|
+
|
78
|
+
NOTE: the key is a flag, if a file was partially processed before Logstash exited some events will be resent.
|
79
|
+
|
80
|
+
[id="plugins-{type}s-{plugin}-processed_db_path"]
|
81
|
+
===== `processed_db_path`
|
82
|
+
|
83
|
+
* Value type is <<path,path>>
|
84
|
+
* Default is: `LOGSTASH_DATA/plugins/inputs/google_cloud_storage/db`.
|
85
|
+
|
86
|
+
If set, the plugin will store the list of processed files locally.
|
87
|
+
This allows you to create a service account for the plugin that does not have write permissions.
|
88
|
+
However, the data will not be shared across multiple running instances of Logstash.
|
89
|
+
|
90
|
+
[id="plugins-{type}s-{plugin}-delete"]
|
91
|
+
===== `delete`
|
92
|
+
|
93
|
+
* Value type is <<boolean,boolean>>
|
94
|
+
* Default is: `false`
|
95
|
+
|
96
|
+
Should the log file be deleted after its contents have been updated?
|
97
|
+
|
98
|
+
[id="plugins-{type}s-{plugin}-unpack_gzip"]
|
99
|
+
===== `unpack_gzip`
|
100
|
+
|
101
|
+
* Value type is <<boolean,boolean>>
|
102
|
+
* Default is: `true`
|
103
|
+
|
104
|
+
If set to `true`, files ending in `.gz` are decompressed before they're parsed by the codec.
|
105
|
+
The file will be skipped if it has the suffix, but can't be opened as a gzip, e.g.
|
106
|
+
if it has a bad magic number.
|
107
|
+
|
108
|
+
|
109
|
+
[id="plugins-{type}s-{plugin}-common-options"]
|
110
|
+
include::{include_path}/{type}.asciidoc[]
|
111
|
+
|
112
|
+
:default_codec!:
|
@@ -0,0 +1,84 @@
|
|
1
|
+
==== Example Configurations
|
2
|
+
|
3
|
+
===== Basic
|
4
|
+
|
5
|
+
Basic configuration to read JSON logs every minute from `my-logs-bucket`.
|
6
|
+
For example, https://cloud.google.com/stackdriver/[Stackdriver logs].
|
7
|
+
|
8
|
+
[source,ruby]
|
9
|
+
----------------------------------
|
10
|
+
input {
|
11
|
+
google_cloud_storage {
|
12
|
+
interval => 60
|
13
|
+
bucket_id => "my-logs-bucket"
|
14
|
+
json_key_file => "/home/user/key.json"
|
15
|
+
file_matches => ".*json"
|
16
|
+
codec => "json_lines"
|
17
|
+
}
|
18
|
+
}
|
19
|
+
output { stdout { codec => rubydebug } }
|
20
|
+
----------------------------------
|
21
|
+
|
22
|
+
===== Idempotent Inserts into Elasticsearch
|
23
|
+
|
24
|
+
If your pipeline might insert the same file multiple times you can use the `line_id` metadata key as a deterministic id.
|
25
|
+
|
26
|
+
The ID has the format: `gs://<bucket_id>/<object_id>:<line_num>@<generation>`.
|
27
|
+
`line_num` represents the nth event deserialized from the file starting at 1.
|
28
|
+
`generation` is a unique id Cloud Storage generates for the object.
|
29
|
+
When an object is overwritten it gets a new generation.
|
30
|
+
|
31
|
+
[source,ruby]
|
32
|
+
----------------------------------
|
33
|
+
input {
|
34
|
+
google_cloud_storage {
|
35
|
+
bucket_id => "batch-jobs-output"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
output {
|
40
|
+
elasticsearch {
|
41
|
+
document_id => "%{[@metadata][gcs][line_id]}"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
----------------------------------
|
45
|
+
|
46
|
+
===== From Cloud Storage to BigQuery
|
47
|
+
|
48
|
+
|
49
|
+
Extract data from Cloud Storage, transform it with Logstash and load it into BigQuery.
|
50
|
+
|
51
|
+
|
52
|
+
[source,ruby]
|
53
|
+
----------------------------------
|
54
|
+
input {
|
55
|
+
google_cloud_storage {
|
56
|
+
interval => 60
|
57
|
+
bucket_id => "batch-jobs-output"
|
58
|
+
file_matches => "purchases.*.csv"
|
59
|
+
json_key_file => "/home/user/key.json"
|
60
|
+
codec => "plain"
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
filter {
|
65
|
+
csv {
|
66
|
+
columns => ["transaction", "sku", "price"]
|
67
|
+
convert => {
|
68
|
+
"transaction" => "integer"
|
69
|
+
"price" => "float"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
output {
|
75
|
+
google_bigquery {
|
76
|
+
project_id => "my-project"
|
77
|
+
dataset => "logs"
|
78
|
+
csv_schema => "transaction:INTEGER,sku:INTEGER,price:FLOAT"
|
79
|
+
json_key_file => "/path/to/key.json"
|
80
|
+
error_directory => "/tmp/bigquery-errors"
|
81
|
+
ignore_unknown_values => true
|
82
|
+
}
|
83
|
+
}
|
84
|
+
----------------------------------
|
data/docs/index.asciidoc
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
:plugin: google_cloud_storage
|
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
|
+
=== Google Cloud Storage Input Plugin
|
19
|
+
|
20
|
+
include::{include_path}/plugin_header.asciidoc[]
|
21
|
+
|
22
|
+
|
23
|
+
==== Description
|
24
|
+
|
25
|
+
Extracts events from files in a Google Cloud Storage bucket.
|
26
|
+
|
27
|
+
Example use-cases:
|
28
|
+
|
29
|
+
* Read https://cloud.google.com/stackdriver/[Stackdriver logs] from a Cloud Storage bucket into Elastic.
|
30
|
+
* Read gzipped logs from cold-storage into Elastic.
|
31
|
+
* Restore data from an Elastic dump.
|
32
|
+
* Extract data from Cloud Storage, transform it with Logstash and load it into BigQuery.
|
33
|
+
|
34
|
+
Note: While this project is partially maintained by Google, this is not an official Google product.
|
35
|
+
|
36
|
+
|
37
|
+
include::metadata.asciidoc[]
|
38
|
+
|
39
|
+
include::examples.asciidoc[]
|
40
|
+
|
41
|
+
include::resources.asciidoc[]
|
42
|
+
|
43
|
+
include::configuration.asciidoc[]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
==== Metadata Attributes
|
2
|
+
|
3
|
+
The plugin exposes several metadata attributes about the object being read.
|
4
|
+
You can access these later in the pipeline to augment the data or perform conditional logic.
|
5
|
+
|
6
|
+
[cols="<,<,<",options="header",]
|
7
|
+
|=======================================================================
|
8
|
+
| Key | Type | Description
|
9
|
+
| `[@metadata][gcs][bucket]` | `string` | The name of the bucket the file was read from.
|
10
|
+
| `[@metadata][gcs][name]` | `string` | The name of the object.
|
11
|
+
| `[@metadata][gcs][metadata]` | `object` | A map of metadata on the object.
|
12
|
+
| `[@metadata][gcs][md5]` | `string` | MD5 hash of the data. Encoded using base64.
|
13
|
+
| `[@metadata][gcs][crc32c]` | `string` | CRC32c checksum, as described in RFC 4960. Encoded using base64 in big-endian byte order.
|
14
|
+
| `[@metadata][gcs][generation]` | `long` | The content generation of the object. Used for object versioning
|
15
|
+
| `[@metadata][gcs][line]` | `long` | The position of the event in the file. 1 indexed.
|
16
|
+
| `[@metadata][gcs][line_id]` | `string` | A deterministic, unique ID describing this line. This lets you do idempotent inserts into Elasticsearch.
|
17
|
+
|=======================================================================
|
18
|
+
|
19
|
+
More information about object metadata can be found in the
|
20
|
+
https://cloud.google.com/storage/docs/json_api/v1/objects[official documentation].
|
@@ -0,0 +1,6 @@
|
|
1
|
+
==== Additional Resources
|
2
|
+
|
3
|
+
* https://cloud.google.com/storage/[Cloud Storage Homepage]
|
4
|
+
* https://cloud.google.com/storage/pricing-summary/[Cloud Storage Pricing]
|
5
|
+
* https://cloud.google.com/iam/docs/service-accounts[IAM Service Accounts]
|
6
|
+
* https://cloud.google.com/docs/authentication/production[Application Default Credentials]
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.
|
2
|
+
|
3
|
+
require 'jar_dependencies'
|
4
|
+
require_jar('com.google.cloud', 'google-cloud-storage', '1.25.0')
|
5
|
+
require_jar('com.fasterxml.jackson.core', 'jackson-core', '2.1.3')
|
6
|
+
require_jar('com.google.api', 'api-common', '1.5.0')
|
7
|
+
require_jar('com.google.api-client', 'google-api-client', '1.23.0')
|
8
|
+
require_jar('com.google.api', 'gax', '1.23.0')
|
9
|
+
require_jar('com.google.api', 'gax-httpjson', '0.40.0')
|
10
|
+
require_jar('com.google.api.grpc', 'proto-google-common-protos', '1.7.0')
|
11
|
+
require_jar('com.google.api.grpc', 'proto-google-iam-v1', '0.8.0')
|
12
|
+
require_jar('com.google.apis', 'google-api-services-storage', 'v1-rev114-1.23.0')
|
13
|
+
require_jar('com.google.auth', 'google-auth-library-credentials', '0.9.0')
|
14
|
+
require_jar('com.google.auth', 'google-auth-library-oauth2-http', '0.9.0')
|
15
|
+
require_jar('com.google.cloud', 'google-cloud-core', '1.25.0')
|
16
|
+
require_jar('com.google.cloud', 'google-cloud-core-http', '1.25.0')
|
17
|
+
require_jar('com.google.code.findbugs', 'jsr305', '3.0.1')
|
18
|
+
require_jar('com.google.code.gson', 'gson', '2.7')
|
19
|
+
require_jar('com.google.errorprone', 'error_prone_annotations', '2.2.0')
|
20
|
+
require_jar('com.google.guava', 'guava', '20.0')
|
21
|
+
require_jar('com.google.guava', 'guava-jdk5', '17.0')
|
22
|
+
require_jar('com.google.http-client', 'google-http-client', '1.23.0')
|
23
|
+
require_jar('com.google.http-client', 'google-http-client-appengine', '1.23.0')
|
24
|
+
require_jar('com.google.http-client', 'google-http-client-jackson', '1.23.0')
|
25
|
+
require_jar('com.google.http-client', 'google-http-client-jackson2', '1.23.0')
|
26
|
+
require_jar('com.google.oauth-client', 'google-oauth-client', '1.23.0')
|
27
|
+
require_jar('com.google.protobuf', 'protobuf-java', '3.5.1')
|
28
|
+
require_jar('com.google.protobuf', 'protobuf-java-util', '3.5.1')
|
29
|
+
require_jar('commons-codec', 'commons-codec', '1.3')
|
30
|
+
require_jar('commons-logging', 'commons-logging', '1.1.1')
|
31
|
+
require_jar('io.grpc', 'grpc-context', '1.9.0')
|
32
|
+
require_jar('io.opencensus', 'opencensus-api', '0.11.1')
|
33
|
+
require_jar('io.opencensus', 'opencensus-contrib-http-util', '0.11.1')
|
34
|
+
require_jar('joda-time', 'joda-time', '2.9.2')
|
35
|
+
require_jar('org.apache.httpcomponents', 'httpclient', '4.0.1')
|
36
|
+
require_jar('org.apache.httpcomponents', 'httpcore', '4.0.1')
|
37
|
+
require_jar('org.codehaus.jackson', 'jackson-core-asl', '1.9.11')
|
38
|
+
require_jar('org.threeten', 'threetenbp', '1.3.3')
|