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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 591cf5490fff99a3a2e9a9ef03160fcd59031d9a503c6a4c99c39493368762c3
4
- data.tar.gz: 10a8d4b28c92b6b56ab4e5cbceee85caf33b22fc362654b9bf3275420c3c2fe4
3
+ metadata.gz: 2e9dc458959b7a2a2c015187d920c3452b63c4cd828e0365b0594025420ebebe
4
+ data.tar.gz: 5741b1585fe3ebe0d47e9dc5c9930aa0a53b46119b9f71875a5267e37fa00c45
5
5
  SHA512:
6
- metadata.gz: 24233ffb06c65fce9b5fd76a44ed1c87ce2b9034abfb64a63d3a3d93ef669752e1771343e61f971b9f70cd458625f6bfaf730ab4bc4c5dc4f5066cd07d9bda12
7
- data.tar.gz: ceed064bf5d745f382d55c687a13dd171bf80ceabb2e18f0544f08ab9a2a39a33000a57321d37a97db5cb133fd5ad3a01f85b6a73dfdaa23aa5fbbc33ff462dd
6
+ metadata.gz: 405b2d086e908f03d644985fc037ce71256bd2c1b05d98788c5e9f5c6ee9037e5d4e0a0e2352a792f2a80b60da633fc93c407160606e80eca4d6a030c5f0e8cf
7
+ data.tar.gz: da44111a8fee4463b957e64874daf12c28edf4d004589679e892cba90f9b54568ab458dd27767ebee25f75186c450ab1c7cc4ecbf94784a0415316101a92487c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-aws-sqs (1.0.7)
4
+ fluent-plugin-aws-sqs (1.0.24)
5
5
  aws-sdk-sqs (>= 1.22.0)
6
6
  fluentd (>= 0.14.0)
7
7
 
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
- attribute_name_to_extract {message custom attribute name, will be extract the string value}
28
-  
29
- region {your_region}
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 {receive_interval_seconds}
45
+ receive_interval {receive interval in seconds} default: 0.1
41
46
 
42
- max_number_of_messages {max_number_of_messages}
47
+ max_number_of_messages {the max number of messages per pull} default: 10
43
48
 
44
- wait_time_seconds {receive_message_wait_time_seconds}
49
+ wait_time_seconds {the receive message wait time in seconds} default: 10
45
50
 
46
- delete_message {delete_message_after_receiving}
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
  ```
@@ -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
- 'body' => message.body.to_s,
81
- 'receipt_handle' => message.receipt_handle.to_s,
82
- 'message_id' => message.message_id.to_s,
83
- 'md5_of_body' => message.md5_of_body.to_s,
84
- 'queue_url' => message.queue_url.to_s
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
@@ -1,3 +1,3 @@
1
1
  module SQS
2
- VERSION = "1.0.24"
2
+ VERSION = "1.0.25"
3
3
  end
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.24
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-02 00:00:00.000000000 Z
13
+ date: 2019-10-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd