fluent-plugin-aws-sqs 1.0.24 → 1.0.25
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/Gemfile.lock +1 -1
- data/README.md +12 -7
- data/lib/fluent/plugin/in_sqs.rb +40 -7
- data/lib/fluent/plugin/version.rb +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: 2e9dc458959b7a2a2c015187d920c3452b63c4cd828e0365b0594025420ebebe
|
4
|
+
data.tar.gz: 5741b1585fe3ebe0d47e9dc5c9930aa0a53b46119b9f71875a5267e37fa00c45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 405b2d086e908f03d644985fc037ce71256bd2c1b05d98788c5e9f5c6ee9037e5d4e0a0e2352a792f2a80b60da633fc93c407160606e80eca4d6a030c5f0e8cf
|
7
|
+
data.tar.gz: da44111a8fee4463b957e64874daf12c28edf4d004589679e892cba90f9b54568ab458dd27767ebee25f75186c450ab1c7cc4ecbf94784a0415316101a92487c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,9 +24,14 @@ This plugin can read data from an AWS SQS.
|
|
24
24
|
|
25
25
|
# following attributes are optional
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
parse_body_as_json {try to parse message.body field as json, if it fails the original field is used} default: false
|
28
|
+
attribute_name_to_extract {message custom attribute name, will be extract the string value} default: nil
|
29
|
+
add_receipt_handle {adds amazon receipt_handle field to the record} default: false
|
30
|
+
add_message_id {adds amazon unique message id} default: false
|
31
|
+
add_md5_of_body {adds the md5 of the message body} default: false
|
32
|
+
add_queue_url {adds the url of the queue the message came from} default: false
|
33
|
+
|
34
|
+
region {your_region} default: nil
|
30
35
|
|
31
36
|
### region list ###
|
32
37
|
# Asia Pacific (Tokyo) [Default] : ap-northeast-1
|
@@ -37,13 +42,13 @@ This plugin can read data from an AWS SQS.
|
|
37
42
|
# EU-West (Ireland) : eu-west-1
|
38
43
|
# South America (São Paulo) : sa-east-1
|
39
44
|
|
40
|
-
receive_interval {
|
45
|
+
receive_interval {receive interval in seconds} default: 0.1
|
41
46
|
|
42
|
-
max_number_of_messages {
|
47
|
+
max_number_of_messages {the max number of messages per pull} default: 10
|
43
48
|
|
44
|
-
wait_time_seconds {
|
49
|
+
wait_time_seconds {the receive message wait time in seconds} default: 10
|
45
50
|
|
46
|
-
delete_message {
|
51
|
+
delete_message {delete the message from the queue after the plugin processing and before the 'router.emit' call} default: false
|
47
52
|
|
48
53
|
</source>
|
49
54
|
```
|
data/lib/fluent/plugin/in_sqs.rb
CHANGED
@@ -19,6 +19,11 @@ module Fluent::Plugin
|
|
19
19
|
config_param :delete_message, :bool, default: false
|
20
20
|
config_param :stub_responses, :bool, default: false
|
21
21
|
config_param :attribute_name_to_extract, :string, default: nil
|
22
|
+
config_param :add_receipt_handle, :bool, default: false
|
23
|
+
config_param :add_message_id, :bool, default: false
|
24
|
+
config_param :add_md5_of_body, :bool, default: false
|
25
|
+
config_param :add_queue_url, :bool, default: false
|
26
|
+
config_param :parse_body_as_json, :bool, default: false
|
22
27
|
|
23
28
|
def configure(conf)
|
24
29
|
super
|
@@ -75,14 +80,42 @@ module Fluent::Plugin
|
|
75
80
|
log.warn_backtrace ex.backtrace
|
76
81
|
end
|
77
82
|
|
83
|
+
def prase_json_string(jsonStr)
|
84
|
+
response = jsonStr
|
85
|
+
|
86
|
+
begin
|
87
|
+
response = JSON.parse(jsonStr)
|
88
|
+
rescue => ex
|
89
|
+
# unable to pase json str (str is not a valid json)
|
90
|
+
end
|
91
|
+
|
92
|
+
response
|
93
|
+
end
|
94
|
+
|
78
95
|
def parse_message(message)
|
79
|
-
record = {
|
80
|
-
|
81
|
-
|
82
|
-
'
|
83
|
-
|
84
|
-
'
|
85
|
-
|
96
|
+
record = {}
|
97
|
+
|
98
|
+
if @parse_body_as_json == true
|
99
|
+
record['body'] = prase_json_string(message.body.to_s)
|
100
|
+
else
|
101
|
+
record['body'] = message.body.to_s
|
102
|
+
end
|
103
|
+
|
104
|
+
if @add_receipt_handle == true
|
105
|
+
record['receipt_handle'] = message.receipt_handle.to_s
|
106
|
+
end
|
107
|
+
|
108
|
+
if @add_message_id == true
|
109
|
+
record['message_id'] = message.message_id.to_s
|
110
|
+
end
|
111
|
+
|
112
|
+
if @add_md5_of_body == true
|
113
|
+
record['md5_of_body'] = message.md5_of_body.to_s
|
114
|
+
end
|
115
|
+
|
116
|
+
if @add_queue_url == true
|
117
|
+
record['queue_url'] = message.queue_url.to_s
|
118
|
+
end
|
86
119
|
|
87
120
|
if @attribute_name_to_extract.to_s.strip.length > 0
|
88
121
|
record[@attribute_name_to_extract] = message.message_attributes[@attribute_name_to_extract].string_value.to_s
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-aws-sqs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shai Moria
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-10-
|
13
|
+
date: 2019-10-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|