# Watcher JSON

**URL:** <https://discuss.elastic.co/t/watcher-json/210396>\
**Category:** Kibana\
**Created:** [December 3, 2019, 4:10pm UTC](https://discuss.elastic.co/t/watcher-json/210396 "2019-12-03T16:10:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brooksly](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@brooksly](https://discuss.elastic.co/u/brooksly)\
**Post date:** [December 3, 2019, 4:10pm UTC](https://discuss.elastic.co/t/watcher-json/210396/1 "2019-12-03T16:10:34Z")

</div>

I'm working on alerting for some winlogbeat indices. This one is for event.id 4625, logon failure. Below in my json: Basically, the end result will be alerting with a single user account failed x number of times within y period of time. Using the DEV tool in Kabana and running the below code, which validates in the dev tool, I get the error below. I having trouble figuring out what its looking for.

JSON CODE:  
{  
"query" : {  
"term": { "winlog.event\_id" : 4625}  
},  
"condition" : {  
"script": {  
"source": "return ctx.payload.hits.total \> params.threshold",  
"lang": "painless",  
"params": {  
"threshold": 5}  
}  
}  
}

RESULTING ERROR:

{  
"error": {  
"root\_cause": [  
{  
"type": "parsing\_exception",  
"reason": "Unknown key for a START\_OBJECT in [condition].",  
"line": 5,  
"col": 17  
}  
],  
"type": "parsing\_exception",  
"reason": "Unknown key for a START\_OBJECT in [condition].",  
"line": 5,  
"col": 17  
},  
"status": 400  
}

 ![kabana_json_dev](https://us1.discourse-cdn.com/elastic/original/3X/8/4/849ebefed39dadc01629e02da94ad85132634fb7.png)

---

<div class="post-metadata">

**Author:** ![alisongoryachev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alisongoryachev/32/111352_2.png) [@alisongoryachev](https://discuss.elastic.co/u/alisongoryachev)\
**Post date:** [December 19, 2019, 2:17pm UTC](https://discuss.elastic.co/t/watcher-json/210396/2 "2019-12-19T14:17:56Z")

</div>

Welcome, @brooksly!

If you are trying to create a new watch, you will need to use the `PUT _watcher/watch/<watch_id>` API. In your screenshot, it looks like you are using `GET _search`. Please refer to the [Watcher API documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) for more details on how to structure the request body.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 16, 2020, 2:18pm UTC](https://discuss.elastic.co/t/watcher-json/210396/3 "2020-01-16T14:18:04Z")

</div>

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