logstash-input-google_pubsub 1.0.6 → 1.1.0
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/CHANGELOG.md +3 -0
- data/docs/index.asciidoc +40 -1
- data/lib/logstash/inputs/google_pubsub.rb +36 -0
- data/logstash-input-google_pubsub.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f39efa6b21fafa252ad3e27a1a1a301681145c88498ac242e7b85a77a64382f
|
4
|
+
data.tar.gz: b92fe3cebc49c21702868a61a06a90c88b0f0372b5a7f57272add4a911359c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a844cf0059e14822f1323a146b4f03b0745ab0f3c5a7c961626f35523059a632ef0169c96cf212612520b1a6ad5c6e428a08c30a82f8a8ffaab15d9c35d6b86b
|
7
|
+
data.tar.gz: 1ca3f6026de8645af0ea71ab648bb52fc76ac4513373d21ad6bd6e39352576b403c56e738905f0f1372182f40e08485fed375b21c7dedd117df866010783d02b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 1.1.0
|
2
|
+
- Add additional attributes in the `[@metadata][pubsub_message]` field. Fixes [#7](https://github.com/logstash-plugins/logstash-input-google_pubsub/issues/7)
|
3
|
+
|
1
4
|
## 1.0.6
|
2
5
|
- Ignore acknowledge requests with an empty array of IDs. Fixes [#14](https://github.com/logstash-plugins/logstash-input-google_pubsub/issues/14)
|
3
6
|
|
data/docs/index.asciidoc
CHANGED
@@ -138,6 +138,38 @@ input {
|
|
138
138
|
output { stdout { codec => rubydebug } }
|
139
139
|
----------------------------------
|
140
140
|
|
141
|
+
==== Metadata and Attributes
|
142
|
+
|
143
|
+
The original Pub/Sub message is preserved in the special Logstash
|
144
|
+
`[@metadata][pubsub_message]` field so you can fetch:
|
145
|
+
|
146
|
+
* Message attributes
|
147
|
+
* The origiginal base64 data
|
148
|
+
* Pub/Sub message ID for de-duplication
|
149
|
+
* Publish time
|
150
|
+
|
151
|
+
You MUST extract any fields you want in a filter prior to the data being sent
|
152
|
+
to an output because Logstash deletes `@metadata` fields otherwise.
|
153
|
+
|
154
|
+
See the PubsubMessage
|
155
|
+
https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage[documentation]
|
156
|
+
for a full description of the fields.
|
157
|
+
|
158
|
+
Example to get the message ID:
|
159
|
+
|
160
|
+
[source,ruby]
|
161
|
+
----------------------------------
|
162
|
+
input {google_pubsub {...}}
|
163
|
+
|
164
|
+
filter {
|
165
|
+
mutate {
|
166
|
+
add_field => { "messageId" => "%{[@metadata][pubsub_message][messageId]}" }
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
output {...}
|
171
|
+
----------------------------------
|
172
|
+
|
141
173
|
|
142
174
|
[id="plugins-{type}s-{plugin}-options"]
|
143
175
|
==== Google_pubsub Input Configuration Options
|
@@ -152,6 +184,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
152
184
|
| <<plugins-{type}s-{plugin}-project_id>> |<<string,string>>|Yes
|
153
185
|
| <<plugins-{type}s-{plugin}-subscription>> |<<string,string>>|Yes
|
154
186
|
| <<plugins-{type}s-{plugin}-topic>> |<<string,string>>|Yes
|
187
|
+
| <<plugins-{type}s-{plugin}-include_metadata>> |<<boolean,boolean>>|No
|
155
188
|
|=======================================================================
|
156
189
|
|
157
190
|
Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
|
@@ -209,9 +242,15 @@ Note that the topic must be created manually with Cloud Logging
|
|
209
242
|
pre-configured export to PubSub configured to use the defined topic.
|
210
243
|
The subscription will be created automatically by the plugin.
|
211
244
|
|
245
|
+
[id="plugins-{type}s-{plugin}-include_metadata"]
|
246
|
+
===== `include_metadata`
|
247
|
+
|
248
|
+
* Value type is <<boolean,boolean>>
|
249
|
+
* Default value is `false`.
|
212
250
|
|
251
|
+
If set true, will include the full message data in the `[@metadata][pubsub_message]` field.
|
213
252
|
|
214
253
|
[id="plugins-{type}s-{plugin}-common-options"]
|
215
254
|
include::{include_path}/{type}.asciidoc[]
|
216
255
|
|
217
|
-
:default_codec!:
|
256
|
+
:default_codec!:
|
@@ -122,6 +122,38 @@ require "google/api_client"
|
|
122
122
|
# output { stdout { codec => rubydebug } }
|
123
123
|
# ----------------------------------
|
124
124
|
#
|
125
|
+
# ==== Metadata and Attributes
|
126
|
+
#
|
127
|
+
# The original Pub/Sub message is preserved in the special Logstash
|
128
|
+
# `[@metadata][pubsub_message]` field so you can fetch:
|
129
|
+
#
|
130
|
+
# * Message attributes
|
131
|
+
# * The origiginal base64 data
|
132
|
+
# * Pub/Sub message ID for de-duplication
|
133
|
+
# * Publish time
|
134
|
+
#
|
135
|
+
# You MUST extract any fields you want in a filter prior to the data being sent
|
136
|
+
# to an output because Logstash deletes `@metadata` fields otherwise.
|
137
|
+
#
|
138
|
+
# See the PubsubMessage
|
139
|
+
# https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage[documentation]
|
140
|
+
# for a full description of the fields.
|
141
|
+
#
|
142
|
+
# Example to get the message ID:
|
143
|
+
#
|
144
|
+
# [source,ruby]
|
145
|
+
# ----------------------------------
|
146
|
+
# input {google_pubsub {...}}
|
147
|
+
#
|
148
|
+
# filter {
|
149
|
+
# mutate {
|
150
|
+
# add_field => { "messageId" => "%{[@metadata][pubsub_message][messageId]}" }
|
151
|
+
# }
|
152
|
+
# }
|
153
|
+
#
|
154
|
+
# output {...}
|
155
|
+
# ----------------------------------
|
156
|
+
#
|
125
157
|
class LogStash::Inputs::GooglePubSub < LogStash::Inputs::Base
|
126
158
|
config_name "google_pubsub"
|
127
159
|
|
@@ -141,6 +173,9 @@ class LogStash::Inputs::GooglePubSub < LogStash::Inputs::Base
|
|
141
173
|
# specify a Service Account JSON key file.
|
142
174
|
config :json_key_file, :validate => :path, :required => false
|
143
175
|
|
176
|
+
# If set true, will include the full message data in the `[@metadata][pubsub_message]` field.
|
177
|
+
config :include_metadata, :validate => :boolean, :required => false, :default => false
|
178
|
+
|
144
179
|
# If undefined, Logstash will complain, even if codec is unused.
|
145
180
|
default :codec, "plain"
|
146
181
|
|
@@ -254,6 +289,7 @@ class LogStash::Inputs::GooglePubSub < LogStash::Inputs::Base
|
|
254
289
|
if msg.key?("message") and msg["message"].key?("data")
|
255
290
|
decoded_msg = Base64.decode64(msg["message"]["data"])
|
256
291
|
@codec.decode(decoded_msg) do |event|
|
292
|
+
event.set("[@metadata][pubsub_message]", msg["message"]) if @include_metadata
|
257
293
|
decorate(event)
|
258
294
|
queue << event
|
259
295
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-google_pubsub'
|
3
|
-
s.version = '1.0
|
3
|
+
s.version = '1.1.0'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = "Consume events from a Google Cloud PubSub service"
|
6
6
|
s.description = "This gem is a Logstash input 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."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-google_pubsub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|