logstash-output-pravega 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +9 -0
  3. data/CONTRIBUTORS +12 -0
  4. data/DEVELOPER.md +1 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +201 -0
  7. data/README.md +143 -0
  8. data/lib/logstash-output-pravega_jars.rb +4 -0
  9. data/lib/logstash/outputs/pravega.rb +96 -0
  10. data/logstash-output-pravega.gemspec +29 -0
  11. data/spec/outputs/pravega_spec.rb +22 -0
  12. data/vendor/jar-dependencies/runtime-jars/annotations-3.0.1.jar +0 -0
  13. data/vendor/jar-dependencies/runtime-jars/commons-cli-1.2.jar +0 -0
  14. data/vendor/jar-dependencies/runtime-jars/commons-io-2.5.jar +0 -0
  15. data/vendor/jar-dependencies/runtime-jars/commons-lang3-3.7.jar +0 -0
  16. data/vendor/jar-dependencies/runtime-jars/curator-client-4.0.0.jar +0 -0
  17. data/vendor/jar-dependencies/runtime-jars/curator-framework-4.0.0.jar +0 -0
  18. data/vendor/jar-dependencies/runtime-jars/curator-recipes-4.0.0.jar +0 -0
  19. data/vendor/jar-dependencies/runtime-jars/error_prone_annotations-2.0.19.jar +0 -0
  20. data/vendor/jar-dependencies/runtime-jars/google-auth-library-credentials-0.4.0.jar +0 -0
  21. data/vendor/jar-dependencies/runtime-jars/grpc-all-1.8.0.jar +0 -0
  22. data/vendor/jar-dependencies/runtime-jars/grpc-auth-1.8.0.jar +0 -0
  23. data/vendor/jar-dependencies/runtime-jars/grpc-context-1.8.0.jar +0 -0
  24. data/vendor/jar-dependencies/runtime-jars/grpc-core-1.8.0.jar +0 -0
  25. data/vendor/jar-dependencies/runtime-jars/grpc-netty-1.8.0.jar +0 -0
  26. data/vendor/jar-dependencies/runtime-jars/grpc-okhttp-1.8.0.jar +0 -0
  27. data/vendor/jar-dependencies/runtime-jars/grpc-protobuf-1.8.0.jar +0 -0
  28. data/vendor/jar-dependencies/runtime-jars/grpc-protobuf-lite-1.8.0.jar +0 -0
  29. data/vendor/jar-dependencies/runtime-jars/grpc-protobuf-nano-1.8.0.jar +0 -0
  30. data/vendor/jar-dependencies/runtime-jars/grpc-stub-1.8.0.jar +0 -0
  31. data/vendor/jar-dependencies/runtime-jars/gson-2.7.jar +0 -0
  32. data/vendor/jar-dependencies/runtime-jars/guava-20.0.jar +0 -0
  33. data/vendor/jar-dependencies/runtime-jars/instrumentation-api-0.4.3.jar +0 -0
  34. data/vendor/jar-dependencies/runtime-jars/jcip-annotations-1.0.jar +0 -0
  35. data/vendor/jar-dependencies/runtime-jars/jsr305-3.0.1.jar +0 -0
  36. data/vendor/jar-dependencies/runtime-jars/log4j-1.2.17.jar +0 -0
  37. data/vendor/jar-dependencies/runtime-jars/lombok-1.16.18.jar +0 -0
  38. data/vendor/jar-dependencies/runtime-jars/netty-3.10.5.Final.jar +0 -0
  39. data/vendor/jar-dependencies/runtime-jars/netty-all-4.1.16.Final.jar +0 -0
  40. data/vendor/jar-dependencies/runtime-jars/netty-buffer-4.1.16.Final.jar +0 -0
  41. data/vendor/jar-dependencies/runtime-jars/netty-codec-4.1.16.Final.jar +0 -0
  42. data/vendor/jar-dependencies/runtime-jars/netty-codec-http-4.1.16.Final.jar +0 -0
  43. data/vendor/jar-dependencies/runtime-jars/netty-codec-http2-4.1.16.Final.jar +0 -0
  44. data/vendor/jar-dependencies/runtime-jars/netty-codec-socks-4.1.16.Final.jar +0 -0
  45. data/vendor/jar-dependencies/runtime-jars/netty-common-4.1.16.Final.jar +0 -0
  46. data/vendor/jar-dependencies/runtime-jars/netty-handler-4.1.16.Final.jar +0 -0
  47. data/vendor/jar-dependencies/runtime-jars/netty-handler-proxy-4.1.16.Final.jar +0 -0
  48. data/vendor/jar-dependencies/runtime-jars/netty-resolver-4.1.16.Final.jar +0 -0
  49. data/vendor/jar-dependencies/runtime-jars/netty-tcnative-boringssl-static-2.0.8.Final.jar +0 -0
  50. data/vendor/jar-dependencies/runtime-jars/netty-transport-4.1.16.Final.jar +0 -0
  51. data/vendor/jar-dependencies/runtime-jars/okhttp-2.5.0.jar +0 -0
  52. data/vendor/jar-dependencies/runtime-jars/okio-1.6.0.jar +0 -0
  53. data/vendor/jar-dependencies/runtime-jars/opencensus-api-0.8.0.jar +0 -0
  54. data/vendor/jar-dependencies/runtime-jars/opencensus-contrib-grpc-metrics-0.8.0.jar +0 -0
  55. data/vendor/jar-dependencies/runtime-jars/pravega-client-0.4.0.jar +0 -0
  56. data/vendor/jar-dependencies/runtime-jars/pravega-common-0.4.0.jar +0 -0
  57. data/vendor/jar-dependencies/runtime-jars/pravega-shared-0.4.0.jar +0 -0
  58. data/vendor/jar-dependencies/runtime-jars/pravega-shared-authplugin-0.4.0.jar +0 -0
  59. data/vendor/jar-dependencies/runtime-jars/pravega-shared-controller-api-0.4.0.jar +0 -0
  60. data/vendor/jar-dependencies/runtime-jars/pravega-shared-protocol-0.4.0.jar +0 -0
  61. data/vendor/jar-dependencies/runtime-jars/proto-google-common-protos-0.1.9.jar +0 -0
  62. data/vendor/jar-dependencies/runtime-jars/protobuf-java-3.4.0.jar +0 -0
  63. data/vendor/jar-dependencies/runtime-jars/protobuf-java-util-3.4.0.jar +0 -0
  64. data/vendor/jar-dependencies/runtime-jars/protobuf-javanano-3.0.0-alpha-5.jar +0 -0
  65. data/vendor/jar-dependencies/runtime-jars/slf4j-api-1.7.25.jar +0 -0
  66. data/vendor/jar-dependencies/runtime-jars/zookeeper-3.5.3-beta.jar +0 -0
  67. metadata +219 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 87ba95cf4a833368e85dafd409f98611c3962bee
4
+ data.tar.gz: db638bd76462fd98cfbf28085ce88c41691bf372
5
+ SHA512:
6
+ metadata.gz: c5687873dde18f9cf5285e5e0d3376653e5bf3b2ab5b9c467fc1d73a5e1289dac774b6a1d5c2dc6cdf018eff04c979fcd0518955bec2bdd997862fd48abcb494
7
+ data.tar.gz: 7fd1ea7fa97916f195d3d51b597161b29be1887fd12451780ba871f9a3fd9593875097e3f912e54944d1ce33b41fdba9187ccc3234ced6e2cf5f15951e948a3e
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ ## 0.4.0
2
+ - Switch the version of pravega-client API to 0.4.0
3
+ - Fix some bugs of the old version
4
+ - Add the argument precheck for output plugin
5
+ - Fix the unnecessary filter again when input_stream is same as outout_stream
6
+ - Fix the bug of writer which can't handle the next round of data ingestion.
7
+
8
+ ## 0.1.0
9
+ - Plugin created with the logstash plugin generator
data/CONTRIBUTORS ADDED
@@ -0,0 +1,12 @@
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
+ * Ben Wang - ben.wang@emc.com
6
+ * Tony Li - tony.li@emc.com
7
+ * Lingling Yao - Lingling.Yao@dell.com
8
+
9
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
10
+ Logstash, and you aren't on the list above and want to be, please let us know
11
+ and we'll make sure you're here. Contributions from folks like you are what make
12
+ open source awesome.
data/DEVELOPER.md ADDED
@@ -0,0 +1 @@
1
+ # logstash-output-pravega
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,143 @@
1
+ # Logstash Output Pravage Plugin
2
+
3
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
+
5
+ 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.
6
+
7
+ ## Documentation
8
+
9
+ 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/).
10
+
11
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
12
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
13
+
14
+ The logstash-output-pravega plugin is upgraded to version: 0.4.0. It can be used to write data to [pravage-0.4.0](https://github.com/pravega/pravega/releases).
15
+
16
+ ## Need Help?
17
+
18
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
19
+
20
+ ## Usage
21
+ - First, have rvm installed. Take how to install it on ubuntu-18~18.04.1 for example. For other OS, find it's installation in [rvm install](https://rvm.io/rvm/install)
22
+ ```sh
23
+ sudo apt-get install software-properties-common
24
+ sudo apt-add-repository -y ppa:rael-gc/rvm
25
+ sudo apt-get update
26
+ sudo apt-get install -y rvm
27
+ ```
28
+
29
+ - Have JRuby with the Bundler gem and mvn installed. It's suggested to install the latest version jrbuy as the old version has bugs.
30
+ ```sh
31
+ rvm install jruby-9.1.17.0
32
+ rvm use jruby-9.1.17.0
33
+ gem install bundler
34
+ ```
35
+
36
+ - Install dependencies
37
+ ```sh
38
+ bundle install
39
+ ```
40
+
41
+ - Install pravega client library
42
+ ```sh
43
+ gem install rake
44
+ rake install_jars
45
+ ```
46
+ - Build pravega output plugin (`logstash-output-pravega-<version>.gem` shall be generated at project root directory)
47
+ ```sh
48
+ gem build logstash-output-pravega.gemspec
49
+ ```
50
+ - Install plugin: ship `logstash-output-pravega-<version>.gem` to target host where logstash is installed
51
+ ```sh
52
+ sudo bin/logstash-plugin install logstash-output-pravega-<version>.gem
53
+ ```
54
+ - Configration
55
+ ```
56
+ e.g.
57
+ output {
58
+ pravega {
59
+ pravega_endpoint => "tcp://<host>:<port>"
60
+ stream_name => "myStream"
61
+ }
62
+ }
63
+ }
64
+ ```
65
+ ```
66
+ # other optional configs. When the controller authorization of pravega is open, the usename and password is required.
67
+
68
+ scope: default: 'global'
69
+ num_of_segments: default: 1
70
+ routing_key: default: ""
71
+ username: default: ""
72
+ password: default: ""
73
+ ```
74
+
75
+ - Restart logstash
76
+
77
+ ## Developing
78
+
79
+ ### 1. Plugin Developement and Testing
80
+
81
+ #### Code
82
+ - To get started, you'll need JRuby with the Bundler gem installed.
83
+
84
+ - 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).
85
+
86
+ - Install dependencies
87
+ ```sh
88
+ bundle install
89
+ ```
90
+
91
+ #### Test
92
+
93
+ - Update your dependencies
94
+ ```sh
95
+ bundle install
96
+ ```
97
+
98
+ - Run tests
99
+ ```sh
100
+ bundle exec rspec
101
+ ```
102
+
103
+ ### 2. Running your unpublished Plugin in Logstash
104
+
105
+ #### 2.1 Run in a local Logstash clone
106
+
107
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
108
+ ```ruby
109
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
110
+ ```
111
+ - Install plugin
112
+ ```sh
113
+ bin/logstash-plugin install --no-verify
114
+ ```
115
+ - Run Logstash with your plugin
116
+ ```sh
117
+ bin/logstash -e 'filter {awesome {}}'
118
+ ```
119
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
120
+
121
+ #### 2.2 Run in an installed Logstash
122
+
123
+ 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:
124
+
125
+ - Build your plugin gem
126
+ ```sh
127
+ gem build logstash-filter-awesome.gemspec
128
+ ```
129
+ - Install the plugin from the Logstash home
130
+ ```sh
131
+ bin/logstash-plugin install /your/local/plugin/logstash-filter-awesome.gem
132
+ ```
133
+ - Start Logstash and proceed to test the plugin
134
+
135
+ ## Contributing
136
+
137
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
138
+
139
+ 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.
140
+
141
+ It is more important to the community that you are able to contribute.
142
+
143
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -0,0 +1,4 @@
1
+ require 'logstash/environment'
2
+
3
+ root_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
4
+ LogStash::Environment.load_runtime_jars! File.join(root_dir, "vendor")
@@ -0,0 +1,96 @@
1
+ # encoding: utf-8
2
+ require "logstash/outputs/base"
3
+ require "logstash/namespace"
4
+ require "java"
5
+ require "logstash-output-pravega_jars.rb"
6
+ require "json"
7
+
8
+ class LogStash::Outputs::Pravega < LogStash::Outputs::Base
9
+ declare_threadsafe!
10
+
11
+ config_name "pravega"
12
+
13
+ default :codec, 'json'
14
+
15
+ config :pravega_endpoint, :validate => :string, :require => true
16
+
17
+ config :stream_name, :validate => :string, :required => true
18
+
19
+ config :scope, :validate => :string, :default => 'global'
20
+
21
+ config :num_of_segments, :validate => :number, :default => 1
22
+
23
+ config :routing_key, :validate => :string, :default => ""
24
+
25
+ config :username, :validate => :string, :default => ""
26
+
27
+ config :password, :validate => :string, :default => ""
28
+
29
+ public
30
+ def register
31
+ end # def register
32
+
33
+ public
34
+ def multi_receive_encoded(encoded)
35
+ pre_check(encoded)
36
+ @producer = create_producer
37
+ encoded.each do |event,data|
38
+ begin
39
+ @producer.writeEvent(routing_key,data)
40
+ logger.debug("write in stream succssfully", :stream_name => @stream_name, :event => data)
41
+ rescue LogStash::ShutdownSignal
42
+ logger.debug("Pravega producer got shutdown signal")
43
+ rescue => e
44
+ logger.warn("Pravega producer threw exception, restarting", :exception => e)
45
+ end
46
+ end
47
+ @producer.close()
48
+ end
49
+
50
+ private
51
+ def pre_check(encoded)
52
+ # If the num_of_segment <= 0, the IllegalArgumentException will be thrown and logstash will stop.
53
+ @num_of_segments = 1 if @num_of_segments <= 0
54
+
55
+ # If the input stream name is same as output, it will filter the formatted json data again and again without endless.
56
+ # So, the new output streamName needs to be created
57
+ encoded.each do |event, data|
58
+ if @stream_name == JSON.parse(data)['streamName']
59
+ @stream_name = "newOutputStream-".concat(SecureRandom.uuid)
60
+ logger.info("The input stream_name shouldn't be equal to output, the new output_stream is created", :stream_name => @stream_name)
61
+ break
62
+ end
63
+ end
64
+ logger.debug("After arugument preCheck ", :num_of_segments => @num_of_segments, :stream_name => @stream_name)
65
+ end
66
+
67
+ private
68
+ def create_producer
69
+ begin
70
+ java_import("io.pravega.client.admin.StreamManager")
71
+ java_import("io.pravega.client.stream.ScalingPolicy")
72
+ java_import("io.pravega.client.stream.StreamConfiguration")
73
+ java_import("io.pravega.client.ClientConfig")
74
+ java_import("io.pravega.client.stream.impl.DefaultCredentials")
75
+ java_import("io.pravega.client.ClientFactory")
76
+ java_import("io.pravega.client.stream.impl.JavaSerializer")
77
+ java_import("io.pravega.client.stream.EventWriterConfig")
78
+
79
+ uri = java.net.URI.new(pravega_endpoint)
80
+ clientConfig = ClientConfig.builder()
81
+ .controllerURI(uri)
82
+ .credentials(DefaultCredentials.new(password, username))
83
+ .validateHostName(false)
84
+ .build()
85
+ streamManager = StreamManager.create(clientConfig)
86
+ streamManager.createScope(scope)
87
+ policy = ScalingPolicy.fixed(@num_of_segments)
88
+ streamConfig = StreamConfiguration.builder().scalingPolicy(policy).build()
89
+ streamManager.createStream(scope, stream_name, streamConfig)
90
+ logger.debug("created stream successfully", :stream => @stream_name)
91
+
92
+ clientFactory = ClientFactory.withScope(scope, clientConfig)
93
+ writer = clientFactory.createEventWriter(stream_name, JavaSerializer.new(), EventWriterConfig.builder().build())
94
+ end
95
+ end
96
+ end # class LogStash::Outputs::Pravega
@@ -0,0 +1,29 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'logstash-output-pravega'
3
+ s.version = '0.4.0'
4
+ s.licenses = ['Apache License (2.0)']
5
+ s.summary = 'Output events to a Pravega Stream. This uses the Pravega Writer API to write event to a stream on the Pravega'
6
+ s.description = 'This gem is a Logstash 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'
7
+ s.authors = ['Ben Wang', 'Tony Li', 'Lingling.Yao']
8
+ s.email = 'ben.wang@emc.com'
9
+ s.require_paths = ['lib']
10
+
11
+ # Files
12
+ s.files = Dir["lib/**/*.rb","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*"]
13
+
14
+ # Tests
15
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
+
17
+ # Special flag to let us know this is actually a logstash plugin
18
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
19
+
20
+ s.requirements << "jar 'io.pravega:pravega-client', '0.4.0'"
21
+
22
+ # Gem dependencies
23
+ s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
24
+ s.add_runtime_dependency 'logstash-codec-plain', '>= 0'
25
+ s.add_runtime_dependency 'stud', '>= 0.0', '>= 0.0.22'
26
+ s.add_development_dependency 'logstash-devutils', '>= 0.0', '>= 0.0.16'
27
+ s.add_development_dependency 'jar-dependencies', '>= 0.3.2'
28
+ s.add_development_dependency 'json', '>= 1.8.3'
29
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ require "logstash/devutils/rspec/spec_helper"
3
+ require "logstash/outputs/pravega"
4
+ require "logstash/codecs/plain"
5
+ require "logstash/event"
6
+
7
+ describe LogStash::Outputs::Pravega do
8
+ let(:sample_event) { LogStash::Event.new }
9
+ let(:output) { LogStash::Outputs::Pravega.new }
10
+
11
+ before do
12
+ output.register
13
+ end
14
+
15
+ describe "receive message" do
16
+ subject { output.receive(sample_event) }
17
+
18
+ it "returns a string" do
19
+ expect(subject).to eq("Event received")
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,219 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-output-pravega
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Wang
8
+ - Tony Li
9
+ - Lingling.Yao
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2019-04-22 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '1.60'
21
+ - - "<="
22
+ - !ruby/object:Gem::Version
23
+ version: '2.99'
24
+ name: logstash-core-plugin-api
25
+ prerelease: false
26
+ type: :runtime
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '1.60'
32
+ - - "<="
33
+ - !ruby/object:Gem::Version
34
+ version: '2.99'
35
+ - !ruby/object:Gem::Dependency
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ name: logstash-codec-plain
42
+ prerelease: false
43
+ type: :runtime
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ - !ruby/object:Gem::Dependency
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0.0'
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 0.0.22
58
+ name: stud
59
+ prerelease: false
60
+ type: :runtime
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0.0'
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.0.22
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0.0'
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 0.0.16
78
+ name: logstash-devutils
79
+ prerelease: false
80
+ type: :development
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0.0'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 0.0.16
89
+ - !ruby/object:Gem::Dependency
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 0.3.2
95
+ name: jar-dependencies
96
+ prerelease: false
97
+ type: :development
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.3.2
103
+ - !ruby/object:Gem::Dependency
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 1.8.3
109
+ name: json
110
+ prerelease: false
111
+ type: :development
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 1.8.3
117
+ description: This gem is a Logstash plugin required to be installed on top of the
118
+ Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
119
+ gem is not a stand-alone program
120
+ email: ben.wang@emc.com
121
+ executables: []
122
+ extensions: []
123
+ extra_rdoc_files: []
124
+ files:
125
+ - CHANGELOG.md
126
+ - CONTRIBUTORS
127
+ - DEVELOPER.md
128
+ - Gemfile
129
+ - LICENSE
130
+ - README.md
131
+ - lib/logstash-output-pravega_jars.rb
132
+ - lib/logstash/outputs/pravega.rb
133
+ - logstash-output-pravega.gemspec
134
+ - spec/outputs/pravega_spec.rb
135
+ - vendor/jar-dependencies/runtime-jars/annotations-3.0.1.jar
136
+ - vendor/jar-dependencies/runtime-jars/commons-cli-1.2.jar
137
+ - vendor/jar-dependencies/runtime-jars/commons-io-2.5.jar
138
+ - vendor/jar-dependencies/runtime-jars/commons-lang3-3.7.jar
139
+ - vendor/jar-dependencies/runtime-jars/curator-client-4.0.0.jar
140
+ - vendor/jar-dependencies/runtime-jars/curator-framework-4.0.0.jar
141
+ - vendor/jar-dependencies/runtime-jars/curator-recipes-4.0.0.jar
142
+ - vendor/jar-dependencies/runtime-jars/error_prone_annotations-2.0.19.jar
143
+ - vendor/jar-dependencies/runtime-jars/google-auth-library-credentials-0.4.0.jar
144
+ - vendor/jar-dependencies/runtime-jars/grpc-all-1.8.0.jar
145
+ - vendor/jar-dependencies/runtime-jars/grpc-auth-1.8.0.jar
146
+ - vendor/jar-dependencies/runtime-jars/grpc-context-1.8.0.jar
147
+ - vendor/jar-dependencies/runtime-jars/grpc-core-1.8.0.jar
148
+ - vendor/jar-dependencies/runtime-jars/grpc-netty-1.8.0.jar
149
+ - vendor/jar-dependencies/runtime-jars/grpc-okhttp-1.8.0.jar
150
+ - vendor/jar-dependencies/runtime-jars/grpc-protobuf-1.8.0.jar
151
+ - vendor/jar-dependencies/runtime-jars/grpc-protobuf-lite-1.8.0.jar
152
+ - vendor/jar-dependencies/runtime-jars/grpc-protobuf-nano-1.8.0.jar
153
+ - vendor/jar-dependencies/runtime-jars/grpc-stub-1.8.0.jar
154
+ - vendor/jar-dependencies/runtime-jars/gson-2.7.jar
155
+ - vendor/jar-dependencies/runtime-jars/guava-20.0.jar
156
+ - vendor/jar-dependencies/runtime-jars/instrumentation-api-0.4.3.jar
157
+ - vendor/jar-dependencies/runtime-jars/jcip-annotations-1.0.jar
158
+ - vendor/jar-dependencies/runtime-jars/jsr305-3.0.1.jar
159
+ - vendor/jar-dependencies/runtime-jars/log4j-1.2.17.jar
160
+ - vendor/jar-dependencies/runtime-jars/lombok-1.16.18.jar
161
+ - vendor/jar-dependencies/runtime-jars/netty-3.10.5.Final.jar
162
+ - vendor/jar-dependencies/runtime-jars/netty-all-4.1.16.Final.jar
163
+ - vendor/jar-dependencies/runtime-jars/netty-buffer-4.1.16.Final.jar
164
+ - vendor/jar-dependencies/runtime-jars/netty-codec-4.1.16.Final.jar
165
+ - vendor/jar-dependencies/runtime-jars/netty-codec-http-4.1.16.Final.jar
166
+ - vendor/jar-dependencies/runtime-jars/netty-codec-http2-4.1.16.Final.jar
167
+ - vendor/jar-dependencies/runtime-jars/netty-codec-socks-4.1.16.Final.jar
168
+ - vendor/jar-dependencies/runtime-jars/netty-common-4.1.16.Final.jar
169
+ - vendor/jar-dependencies/runtime-jars/netty-handler-4.1.16.Final.jar
170
+ - vendor/jar-dependencies/runtime-jars/netty-handler-proxy-4.1.16.Final.jar
171
+ - vendor/jar-dependencies/runtime-jars/netty-resolver-4.1.16.Final.jar
172
+ - vendor/jar-dependencies/runtime-jars/netty-tcnative-boringssl-static-2.0.8.Final.jar
173
+ - vendor/jar-dependencies/runtime-jars/netty-transport-4.1.16.Final.jar
174
+ - vendor/jar-dependencies/runtime-jars/okhttp-2.5.0.jar
175
+ - vendor/jar-dependencies/runtime-jars/okio-1.6.0.jar
176
+ - vendor/jar-dependencies/runtime-jars/opencensus-api-0.8.0.jar
177
+ - vendor/jar-dependencies/runtime-jars/opencensus-contrib-grpc-metrics-0.8.0.jar
178
+ - vendor/jar-dependencies/runtime-jars/pravega-client-0.4.0.jar
179
+ - vendor/jar-dependencies/runtime-jars/pravega-common-0.4.0.jar
180
+ - vendor/jar-dependencies/runtime-jars/pravega-shared-0.4.0.jar
181
+ - vendor/jar-dependencies/runtime-jars/pravega-shared-authplugin-0.4.0.jar
182
+ - vendor/jar-dependencies/runtime-jars/pravega-shared-controller-api-0.4.0.jar
183
+ - vendor/jar-dependencies/runtime-jars/pravega-shared-protocol-0.4.0.jar
184
+ - vendor/jar-dependencies/runtime-jars/proto-google-common-protos-0.1.9.jar
185
+ - vendor/jar-dependencies/runtime-jars/protobuf-java-3.4.0.jar
186
+ - vendor/jar-dependencies/runtime-jars/protobuf-java-util-3.4.0.jar
187
+ - vendor/jar-dependencies/runtime-jars/protobuf-javanano-3.0.0-alpha-5.jar
188
+ - vendor/jar-dependencies/runtime-jars/slf4j-api-1.7.25.jar
189
+ - vendor/jar-dependencies/runtime-jars/zookeeper-3.5.3-beta.jar
190
+ homepage:
191
+ licenses:
192
+ - Apache License (2.0)
193
+ metadata:
194
+ logstash_plugin: 'true'
195
+ logstash_group: output
196
+ post_install_message:
197
+ rdoc_options: []
198
+ require_paths:
199
+ - lib
200
+ required_ruby_version: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ requirements:
211
+ - jar 'io.pravega:pravega-client', '0.4.0'
212
+ rubyforge_project:
213
+ rubygems_version: 2.6.14.1
214
+ signing_key:
215
+ specification_version: 4
216
+ summary: Output events to a Pravega Stream. This uses the Pravega Writer API to write
217
+ event to a stream on the Pravega
218
+ test_files:
219
+ - spec/outputs/pravega_spec.rb