Jira integration with ELK Stack

Raghwendra Sonu
3 min readOct 23, 2019

--

In this article we are going to retrieve all the bugs in my Jira project and fetch them into Elasticsearch using Logstash. Later we will visualize them on Kibana. So , here are the steps:

As you see in the above snapshot, 
Jira Base URL: https://qatechtesting.atlassian.net/
Project Key: QA

Here is the documentation of Jira Rest API’s: https://docs.atlassian.com/DAC/rest/jira/6.1.html

As mentioned on this page, the API to get all bug details is : /rest/api/2/search?jql=project=”Project Key”. We will use this shortly.

Create a config file for Logstash with below content:

input {
http_poller {
urls => {
test1 => "https://qatechtesting.atlassian.net"
test2 => {
method => get
user => "sonucts@gmail.com"
password => "**********************"
url => "https://qatechtesting.atlassian.net/rest/api/2/search?jql=project=%22QA%22"
headers => {
Accept => "application/json"
}
}
}
request_timeout => 20
schedule => { every =>"20s"}
codec => "json"
}
}
output
{
elasticsearch {
hosts => ["localhost:9200"]
index => "jirabugs"
}
stdout {codec => rubydebug }
}

My Jira details is as below, you can create your own Jira and then use that for this example.

Base URL:https://qatechtesting.atlassian.net
Username:sonucts@gmail.com
Password:<<Note that the password is NOT your password to login, but an API token. To generate an API token, go to https://id.atlassian.com/manage/api-tokens# and create a new one. >>

If you are yet to setup and config ELK stack, have a look at ELK section here: https://medium.com/@Raghwendra.sonu/integrating-sonarqube-with-postgresql-database-and-pushing-data-to-elk-stack-82f34d9cbfb3

Open windows CMD, CD to root directory. And pass config file in parameter and launch logstash.bat file from CMD.

logstash -f   C:\Automation\ELK\GetAllIssuesFromJiraUsingHttpPoller.conf

Now, goto Management tab and then Index Pattern. We have to create a new index pattern. Creating Index Pattern meaning, mapping Kibana UI with Elasticsearch Index. Since, i have used index => “jirabugs” so, i will create an index with this.

Later you can create Visualizations and add them on the dashboard as below.

That’s It

Hope you found it useful! If you ever need my help, you can write in comments sections. Also, you can contact me through my personal website: www.QATechTesting.com or through my LinkedIn Profile.

--

--

Raghwendra Sonu

Software Automation Testing expert with 9 years of work experience in diverse tools and technologies.