Skip to content

Commit 9ef01c6

Browse files
committed
Add reducer configuration, test data, increment patch version, and add details.json
1 parent 5590179 commit 9ef01c6

File tree

5 files changed

+182
-5
lines changed

5 files changed

+182
-5
lines changed

config/config.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,10 @@
242242
"userCanEdit": false,
243243
"adminOnly": true
244244
}
245-
]
246-
}
245+
],
246+
"reducer": {
247+
"details": {
248+
"file": "./reducers/details.json"
249+
}
250+
}
251+
}

mocks/details.json

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
"totalResults": 47,
3+
"from": 0,
4+
"size": 10,
5+
"results": [
6+
{
7+
"hit": {
8+
"_index": "security-logs-2024.01",
9+
"_type": "_doc",
10+
"_id": "AYcZ1XkBT7_9MqJxR_2L",
11+
"_score": 12.453,
12+
"_source": {
13+
"timestamp": "2024-01-16T03:15:42.000Z",
14+
"source_ip": "192.168.1.50",
15+
"destination_ip": "10.0.0.15",
16+
"source_port": 54321,
17+
"destination_port": 443,
18+
"protocol": "HTTPS",
19+
"bytes_sent": 2048,
20+
"bytes_received": 8192,
21+
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
22+
"http_method": "POST",
23+
"url": "/api/v1/authenticate",
24+
"response_code": 200,
25+
"country": "United States",
26+
"city": "San Francisco",
27+
"threat_score": 0,
28+
"threat_level": "low"
29+
}
30+
},
31+
"details": [
32+
{
33+
"label": "Source IP",
34+
"value": "192.168.1.50"
35+
},
36+
{
37+
"label": "Destination IP",
38+
"value": "10.0.0.15"
39+
},
40+
{
41+
"label": "Timestamp",
42+
"value": "2024-01-16T03:15:42.000Z"
43+
}
44+
]
45+
},
46+
{
47+
"hit": {
48+
"_index": "security-logs-2024.01",
49+
"_type": "_doc",
50+
"_id": "AYcZ1YkBT7_9MqJxS_3M",
51+
"_score": 11.892,
52+
"_source": {
53+
"timestamp": "2024-01-16T02:45:18.000Z",
54+
"source_ip": "203.0.113.45",
55+
"destination_ip": "198.51.100.22",
56+
"source_port": 48123,
57+
"destination_port": 22,
58+
"protocol": "SSH",
59+
"bytes_sent": 512,
60+
"bytes_received": 1024,
61+
"user": "admin",
62+
"auth_method": "password",
63+
"auth_result": "failed",
64+
"country": "Unknown",
65+
"threat_score": 85,
66+
"threat_level": "high"
67+
}
68+
},
69+
"details": [
70+
{
71+
"label": "Source IP",
72+
"value": "203.0.113.45"
73+
},
74+
{
75+
"label": "Auth Result",
76+
"value": "failed"
77+
},
78+
{
79+
"label": "Threat Score",
80+
"value": 85
81+
}
82+
]
83+
},
84+
{
85+
"hit": {
86+
"_index": "security-logs-2024.01",
87+
"_type": "_doc",
88+
"_id": "AYcZ1ZkBT7_9MqJxT_4N",
89+
"_score": 10.234,
90+
"_source": {
91+
"timestamp": "2024-01-16T01:30:05.000Z",
92+
"source_ip": "10.0.0.100",
93+
"destination_ip": "8.8.8.8",
94+
"source_port": 53214,
95+
"destination_port": 53,
96+
"protocol": "DNS",
97+
"query": "malicious-domain.com",
98+
"query_type": "A",
99+
"response_code": "NXDOMAIN",
100+
"country": "United States",
101+
"threat_score": 95,
102+
"threat_level": "critical",
103+
"malware_family": "DarkComet"
104+
}
105+
},
106+
"details": [
107+
{
108+
"label": "DNS Query",
109+
"value": "malicious-domain.com"
110+
},
111+
{
112+
"label": "Threat Level",
113+
"value": "critical"
114+
},
115+
{
116+
"label": "Malware Family",
117+
"value": "DarkComet"
118+
}
119+
]
120+
}
121+
],
122+
"tags": [
123+
"Source: 192.168.1.50",
124+
"Destination: 10.0.0.15",
125+
"Protocol: HTTPS",
126+
"Country: United States",
127+
"Threat: high"
128+
],
129+
"queries": [
130+
"{\"query\": { \"simple_query_string\": { \"query\": \"\\\"192.168.1.50\\\"\" } }, \"sort\": [ {\"timestamp\": \"desc\" } ] }"
131+
],
132+
"highlights": {
133+
"AYcZ1XkBT7_9MqJxR_2L": [
134+
{
135+
"fieldName": "source_ip",
136+
"fieldValues": [
137+
"Traffic from <span class=\"highlight\">192.168.1.50</span> detected"
138+
]
139+
}
140+
]
141+
},
142+
"isConnectionReset": false,
143+
"maxRequestQueueLimitHit": false,
144+
"isGatewayTimeout": false,
145+
"isProtoError": false
146+
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Elasticsearch",
3-
"version": "3.7.0",
3+
"version": "3.7.1",
44
"main": "./integration.js",
55
"description": "Search your data in real-time",
66
"private": true,

reducers/details.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"root": {
3+
"path": "",
4+
"on_null": "return_empty"
5+
},
6+
"pipeline": [
7+
{
8+
"op": "copy",
9+
"from": "totalResults",
10+
"to": "reduced_results.total_results"
11+
},
12+
{
13+
"op": "copy",
14+
"from": "tags",
15+
"to": "reduced_results.tags"
16+
},
17+
{
18+
"op": "prune",
19+
"strategy": "empty_values",
20+
"target": "reduced_results"
21+
}
22+
],
23+
"output": {
24+
"result": "$working.reduced_results"
25+
}
26+
}

0 commit comments

Comments
 (0)