-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSentin-config
89 lines (89 loc) · 2.48 KB
/
Sentin-config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
"actions": {
"Webhook_86ccf137-5981-402e-bb04-a3d7b1ea6fa6": {
"name": "Webhook",
"webhook": {
"priority": "high",
"stateless": false,
"method": "POST",
"host": "192.168.10.190",
"port": "8002",
"path": "/api/logs/mail/error_logs_notify",
"body": "[{{#payload.results}}{\"appName\": \"{{appName}}\", \"errors\": [{{#errors}}{\"type\": \"{{type}}\",\"index\": \"{{index}}\",\"id\": \"{{id}}\", \"message\": \"{{message}}\"}{{#comma_e}},{{/comma_e}}{{/errors}}]}{{#comma_b}},{{/comma_b}}{{/payload.results}}]",
"headers": {
"Content-Type": "application/json"
}
}
}
},
"input": {
"search": {
"request": {
"index": [
"isys*"
],
"body": {
"query": {
"bool": {
"must": [
{
"match": {
"loglevel": "ERROR"
}
},
{
"range": {
"@timestamp": {
"gte": "now-10m",
"lt": "now"
}
}
}
]
}
},
"aggs": {
"app_errors": {
"terms": {
"field": "appname.keyword"
},
"aggs": {
"errors": {
"top_hits": {
"size": 10,
"_source": {
"includes": [
"message"
]
}
}
}
}
}
}
}
}
}
},
"condition": {
"script": {
"script": "payload.hits.total > 0"
}
},
"transform": {
"script": {
"script": "payload.results=[];payload.aggregations.app_errors.buckets.forEach(function(b,bi){var r={};r.appName=b.key;r.errors=[];if(bi!=payload.aggregations.app_errors.buckets.length-1){r.comma_b=true}b.errors.hits.hits.forEach(function(h,hi){var v={};v.id=h._id;v.type=h._type;v.index = h._index;v.message=escape(h._source.message);if(hi!=b.errors.hits.hits.length-1){v.comma_e=true}r.errors.push(v)});payload.results.push(r)})"
}
},
"trigger": {
"schedule": {
"later": "every 10 minutes"
}
},
"disable": false,
"report": false,
"title": "isyscore_error_watcher",
"save_payload": false,
"spy": false,
"impersonate": false
}