I am trying to create an alert in TheHive4 with some observables using watcher. Using the postman tool I am able to send API requests, below is the postman request body. observables are under artifacts. An array of JSON Objects.
{
"title": "Test Title",
"description": "Testing alert creation through the API",
"tags": ["testing" , "API"],
"type": "external",
"source": "postman",
"sourceRef": "111111",
"severity": 1,
"tlp": 0,
"artifacts": [
{ "dataType": "ip", "data": "127.0.0.1", "message": "localhost" },
{ "dataType": "hash", "data": "lasgjjaskrgjiwrj", "message": "localhost" }
]
}
In Kibana Devtools I replicated the same request as given below.
PUT _watcher/watch/Watcher_to_Hive2
{
"trigger": {
"schedule": {
"interval": "5m"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"testindex-1*"
],
"rest_total_hits_as_int": true,
"body": {
"size": 0,
"query": {
"match": {
"process": "YASHUKASH.EXE"
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 1
}
}
},
"actions": {
"victorops": {
"webhook": {
"scheme": "http",
"host": "15.00.00.130",
"port": 9000,
"method": "post",
"path": "api/alert",
"params": {
"process": "{{ctx.watch_id}}",
"description": "description",
"source": "source",
"type": "type",
"sourceRef": "Watcher1",
"title": "Watcher_test"
},
"data-raw":{
"title": "Test Ale",
"description": "Testing alert creation through the API",
"tags": ["testing" , "API"],
"type": "external",
"source": "postman",
"sourceRef": "10299",
"severity": 1,
"tlp": 0,
"organization":"test",
"artifacts": {
[
{ "dataType": "ip", "data": "127.0.0.1", "message": "localhost" },
{ "dataType": "hash", "data": "lasgjjaskrgjiwrj", "message": "localhost" }
]},
"headers": {
"Authorization": "Bearer Token******Token",
"Content-Type": "application/json; charset=UTF-8"
},
"body": ""
}
}
}
}
In Kibana watcher also I can create an alert to TheHive4 but cannot use artifacts (Array of JSON objects). If I use artifacts it is giving me 400 errors. Error is as follows
{
"error" : {
"root_cause" : [
{
"type" : "x_content_parse_exception",
"reason" : "[50:7] [script] unknown field [dataType]"
}
],
"type" : "x_content_parse_exception",
"reason" : "[50:7] [script] unknown field [dataType]"
},
"status" : 400
}
How do I define an array of JSON objects in watcher?