Class: LogStash::Outputs::Jira

Inherits:
Base show all
Defined in:
lib/logstash/outputs/jira.rb

Overview

This is so is most useful so you can use logstash to parse and structure your logs and ship structured, json events to JIRA

To use this, you’ll need to ensure your JIRA instance allows REST calls

Constant Summary

Constants included from Config::Mixin

Config::Mixin::CONFIGSORT

Instance Attribute Summary

Attributes included from Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Instance Method Summary collapse

Methods inherited from Base

#handle, #handle_worker, #initialize, #worker_setup, #workers_not_supported

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s

Constructor Details

This class inherits a constructor from LogStash::Outputs::Base

Instance Method Details

#receive(event) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/logstash/outputs/jira.rb', line 74

def receive(event)
  return unless output?(event)

  if event == LogStash::SHUTDOWN
    finished
    return
  end

  Jiralicious.configure do |config|
    config.username = @username
    config.password = @password
    config.uri = @host
    config.auth_type = :cookie
    config.api_version = "latest"
  end


issue = Jiralicious::Issue.new
  issue.fields.set_id("project", @projectid) # would have prefered a project key, https://github.com/jstewart/jiralicious/issues/16
  issue.fields.set("summary", @summary)
  issue.fields.set_id("issuetype", @issuetypeid)
  issue.fields.set_name("reporter", @reporter)
  issue.fields.set_name("assignee", @assignee)
  issue.fields.set_id("priority", @priority)
#puts issue.fields.to_yaml
  issue.save



#    if response.is_a?(Net::HTTPSuccess)
#      @logger.info("Event send to JIRA OK!")
#    else
#      @logger.warn("HTTP error", :error => response.error!)
#    end
end

#registerObject



68
69
70
71
# File 'lib/logstash/outputs/jira.rb', line 68

def register
  require "jiralicious" # 0.2.2 works for me
  # nothing to do
end