Unable to create jira issue in watcher action

I am going post only action part of my watch here. For the same watch am able to create email notification but not able to create jira notification.

"actions" : {
"create-jira-issue" : {
"jira" : {
"account" : "abc@xyz.com",
"issue" : {
"project" : {
"key": "MYTEST"
},
"issuetype" : {
"name": "Bug"
},
"summary" : "Encountered {{ctx.payload.hits.total}} errors in the last 5 minutes",
"description" : "Encountered {{ctx.payload.hits.total}} errors in the last 5 minutes (facepalm)",
"labels" : ["auto"],
"priority" : {
"name" : "High"
}
}
}
}
}

Error is:
{
"error": {
"root_cause": [
{
"type": "parse_exception",
"reason": "failed to parse [jira] action [error-watch/create-jira-issue]. unexpected token [START_OBJECT/issue]"
}
],
"type": "parse_exception",
"reason": "failed to parse [jira] action [error-watch/create-jira-issue]. unexpected token [START_OBJECT/issue]"
},
"status": 400
}

Hey,

can you please try to format your messages appropriately instead of just pasting them here? This makes them much easier to read. See the markdown docs to get easily good results.

On to the issue. This looks like a glitch in our docs. Can you try to wrap the jira fields in its own fields tag and see if that works? If it does I'll update the docs.

"actions" : {
  "create-jira-issue" : {
    "jira" : {
      "account" : "abc@xyz.com", 
      "fields" : {
        "issue" : {
        ...
        }
      }
    }

--Alex

Sorry for the improper format. On wrapping up jira elements inside fields tag overcome the problem. This works for me. Thanks for response.

Hey, watch is implemented successful but jira action execution fails i.e. "successful": false. The same use case is working with email action, stats shows:

            "last_execution": {
              "reason": "",
              "timestamp": "2017-01-12T10:34:26.905Z",
              "successful": false

Jira configuration in elasticsearch.yml is according to the documentation. I am not getting things properly from documentation. Is any configuration change required from jira side also. Please also clarify what account :monitoring is.

xpack.notification.jira:
account:
monitoring:
url: https://internal-jira.elastic.co:443
user: B0
password: ms

Hey,

please paste the watch history entry for the last run here for further debugging.

The account in your example is just the name of the account, it could also be anythingelse. This is just used as an identifier when you add several jira accounts, and you want to specifiy to which jira instance you are sending data in a watch.

--Alex

{

"took": 1,

"timed_out": false,

"_shards": {

"total": 1,

"successful": 1,

"failed": 0

},

"hits": {

"total": 1,

"max_score": 1,

"hits": [

  {

    "_index": ".watches",

    "_type": "watch",

    "_id": "error1",

    "_score": 1,

    "_source": {

      "trigger": {

        "schedule": {

          "interval": "2m"

        }

      },

      "input": {

        "search": {

          "request": {

            "search_type": "query_then_fetch",

            "indices": [

              "logstash*"

            ],

            "types": [],

            "body": {

              "query": {

                "bool": {

                  "must": [

                    {

                      "match_phrase": {

                        "application_message": " Outgoing status: 200"

                      }

                    }

                  ],

                  "filter": [

                    {

                      "range": {

                        "@timestamp": {

                          "gt": "now-1h"

                        }

                      }

                    }

                  ]

                }

              }

            }

          }

        }

      },

      "condition": {

        "compare": {

          "ctx.payload.hits.total": {

            "gt": 0

          }

        }

      },

      "actions": {

        "create-jira-issue": {

          "jira": {

            "account": "monitoring",

            "fields": {

              "issue": {

                "summary": "Encountered {{ctx.payload.hits.total}} errors in the last 5 minutes",

                "issuetype": {

                  "name": "Bug"

                },

                "project": {

                  "key": "MYTEST"

                },

                "description": "Encountered {{ctx.payload.hits.total}} errors in the last 5 minutes (facepalm)"

              }

            }

          }

        }

      },

      "_status": {

        "state": {

          "active": true,

          "timestamp": "2017-01-12T10:11:51.841Z"

        },

        "actions": {

          "create-jira-issue": {

            "ack": {

              "timestamp": "2017-01-12T10:11:51.841Z",

              "state": "awaits_successful_execution"

            },

            "last_execution": {

              "reason": "",

              "timestamp": "2017-01-12T11:18:26.734Z",

              "successful": false

            }

          }

        },

        "last_checked": "2017-01-12T11:18:26.734Z",

        "last_met_condition": "2017-01-12T11:18:26.734Z"

      }

    }

  }

]

}

}

That was the .watches I suppose but not the watch history one? You can also just use the Execute Watch API and paste the output here. Please make sure it's nicely formatted, your posts are not easy to read and make it hard to follow steps.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.