Class: LogStash::Outputs::Stride
- Inherits:
-
Base
- Object
- Base
- LogStash::Outputs::Stride
- Defined in:
- lib/logstash/outputs/stride.rb
Overview
An example output that does nothing.
Instance Method Summary collapse
- #post_message(access_token, cloud_id, conversation_id, host, type, message) ⇒ Object
- #receive(event) ⇒ Object
- #register ⇒ Object
Instance Method Details
permalink #post_message(access_token, cloud_id, conversation_id, host, type, message) ⇒ Object
[View source]
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/logstash/outputs/stride.rb', line 37 def (access_token,cloud_id,conversation_id,host,type,) = %Q|#{type} : #{}| if type = %Q|#{host} : #{}| if host puts "Type : #{type}, Host : #{host}" uri = URI.parse("https://api.atlassian.com/site/#{cloud_id}/conversation/#{conversation_id}/message") request = Net::HTTP::Post.new(uri) request.content_type = "application/json" request["Authorization"] = "Bearer #{access_token}" request.body = '{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"'++'"}]}]}' = { use_ssl: uri.scheme == "https", } response = Net::HTTP.start(uri.hostname, uri.port, ) do |http| http.request(request) end end |
permalink #receive(event) ⇒ Object
[View source]
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/logstash/outputs/stride.rb', line 23 def receive(event) access_token = event.sprintf(@access_token) cloud_id = event.sprintf(@cloud_id) conversation_id = event.sprintf(@conversation_id) host = event.sprintf(@host) type = event.sprintf(@type) = event.sprintf(@message) (access_token,cloud_id,conversation_id,host,type,) rescue Exception => e puts e. end |
permalink #register ⇒ Object
[View source]
19 20 |
# File 'lib/logstash/outputs/stride.rb', line 19 def register end |