Skip to content

Commit 03fe6cd

Browse files
authored
Dev opensearch output stores event object (#859)
* add opensearch output to ng connectors * implement new error handling to bulk
1 parent e40b78d commit 03fe6cd

File tree

8 files changed

+2875
-48
lines changed

8 files changed

+2875
-48
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"concatenator",
4949
"depseudonymization",
5050
"encrypter",
51+
"opensearchpy",
5152
"PKCS",
5253
"pseudonymization",
5354
"pseudonymize",

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
### Features
77

88
### Improvements
9+
10+
* make `processors` handle Event class based objects
11+
* add an EventBacklog class hierarchies
12+
* implement an iterator interface to Input connectors
13+
* make simple connectors handle Event class based objects
14+
* make `opensearch_output` handle Event class based objects
15+
* deprecate `s3_output` as it does not fit into new architecture
16+
* deprecate `http_output` as it does not fit into new architecture
17+
918
### Bugfix
1019

1120
## 17.0.1

doc/source/development/notebooks/new_architecture_examples/4_further_event_classes.ipynb

Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,45 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {},
6-
"source": "# Specialized Event Classes: ErrorEvent, PseudonymEvent, SreEvent\n"
6+
"source": [
7+
"# Specialized Event Classes: ErrorEvent, PseudonymEvent, SreEvent\n"
8+
]
79
},
810
{
9-
"metadata": {},
1011
"cell_type": "markdown",
11-
"source": "Overview of specialized Event Classes with further data."
12+
"metadata": {},
13+
"source": [
14+
"Overview of specialized Event Classes with further data."
15+
]
1216
},
1317
{
14-
"metadata": {},
1518
"cell_type": "markdown",
16-
"source": "**ErrorEvent**"
19+
"metadata": {},
20+
"source": [
21+
"**ErrorEvent**"
22+
]
1723
},
1824
{
25+
"cell_type": "code",
26+
"execution_count": 1,
1927
"metadata": {
2028
"ExecuteTime": {
2129
"end_time": "2025-07-04T08:29:47.373152Z",
2230
"start_time": "2025-07-04T08:29:47.353933Z"
2331
}
2432
},
25-
"cell_type": "code",
33+
"outputs": [
34+
{
35+
"name": "stdout",
36+
"output_type": "stream",
37+
"text": [
38+
"received\n",
39+
"processing\n",
40+
"failed\n",
41+
"ErrorEvent(data={'@timestamp': '2025-07-28T06:33:20.184077+00:00', 'reason': \"Field 'data' has to be a string!\", 'original': b'data: 1', 'event': b\"{'data': 1}\"}, state=receiving)\n"
42+
]
43+
}
44+
],
2645
"source": [
2746
"from logprep.ng.event.error_event import ErrorEvent\n",
2847
"from logprep.ng.event.log_event import LogEvent\n",
@@ -37,38 +56,43 @@
3756
"error_event = ErrorEvent(log_event=log_event, reason=TypeError(\"Field 'data' has to be a string!\"))\n",
3857
"\n",
3958
"print(error_event)"
40-
],
41-
"outputs": [
42-
{
43-
"name": "stdout",
44-
"output_type": "stream",
45-
"text": [
46-
"received\n",
47-
"processing\n",
48-
"failed\n",
49-
"ErrorEvent(data={'@timestamp': '2025-07-04T08:29:47.370650+00:00', 'reason': \"Field 'data' has to be a string!\", 'original': b'data: 1', 'event': b\"{'data': 1}\"}, state=receiving)\n"
50-
]
51-
}
52-
],
53-
"execution_count": 1
59+
]
5460
},
5561
{
56-
"metadata": {},
5762
"cell_type": "markdown",
58-
"source": "**SreEvent** and **PseudonymEvent** don't have any additional data; they only serve to distinguish between the event types."
63+
"metadata": {},
64+
"source": [
65+
"**SreEvent** and **PseudonymEvent** don't have any additional data; they only serve to distinguish between the event types."
66+
]
5967
},
6068
{
69+
"cell_type": "code",
70+
"execution_count": null,
6171
"metadata": {
6272
"ExecuteTime": {
6373
"end_time": "2025-07-04T08:32:18.392509Z",
6474
"start_time": "2025-07-04T08:32:18.379941Z"
6575
}
6676
},
67-
"cell_type": "code",
77+
"outputs": [
78+
{
79+
"ename": "TypeError",
80+
"evalue": "ExtraDataEvent.__init__() missing 1 required keyword-only argument: 'outputs'",
81+
"output_type": "error",
82+
"traceback": [
83+
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
84+
"\u001b[31mTypeError\u001b[39m Traceback (most recent call last)",
85+
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[2]\u001b[39m\u001b[32m, line 3\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mlogprep\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mng\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mevent\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01msre_event\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m SreEvent\n\u001b[32m----> \u001b[39m\u001b[32m3\u001b[39m sre_event = \u001b[43mSreEvent\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m=\u001b[49m\u001b[43m{\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mdata\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[32;43m1\u001b[39;49m\u001b[43m}\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 5\u001b[39m \u001b[38;5;66;03m# Simulate log_event states\u001b[39;00m\n\u001b[32m 6\u001b[39m \u001b[38;5;28mprint\u001b[39m(sre_event.state.next_state()) \u001b[38;5;66;03m# RECEIVED\u001b[39;00m\n",
86+
"\u001b[31mTypeError\u001b[39m: ExtraDataEvent.__init__() missing 1 required keyword-only argument: 'outputs'"
87+
]
88+
}
89+
],
6890
"source": [
6991
"from logprep.ng.event.sre_event import SreEvent\n",
7092
"\n",
71-
"sre_event = SreEvent(data={\"data\": 1})\n",
93+
"outputs = ({\"output\": \"output1\"}, {\"output\": \"output2\"})\n",
94+
"\n",
95+
"sre_event = SreEvent(data={\"data\": 1}, outputs=outputs)\n",
7296
"\n",
7397
"# Simulate log_event states\n",
7498
"print(sre_event.state.next_state()) # RECEIVED\n",
@@ -77,27 +101,12 @@
77101
"print(sre_event.state.next_state()) # STORED_IN_OUTPUT\n",
78102
"print(sre_event.state.next_state(success=True)) # successfully DELIVERED\n",
79103
"print(sre_event.state.next_state()) # ACKED"
80-
],
81-
"outputs": [
82-
{
83-
"name": "stdout",
84-
"output_type": "stream",
85-
"text": [
86-
"received\n",
87-
"processing\n",
88-
"processed\n",
89-
"stored_in_output\n",
90-
"delivered\n",
91-
"acked\n"
92-
]
93-
}
94-
],
95-
"execution_count": 2
104+
]
96105
}
97106
],
98107
"metadata": {
99108
"kernelspec": {
100-
"display_name": "Python 3.11.0 ('.venv': venv)",
109+
"display_name": ".venv",
101110
"language": "python",
102111
"name": "python3"
103112
},
@@ -111,14 +120,9 @@
111120
"name": "python",
112121
"nbconvert_exporter": "python",
113122
"pygments_lexer": "ipython3",
114-
"version": "3.11.0"
123+
"version": "3.12.3"
115124
},
116-
"orig_nbformat": 4,
117-
"vscode": {
118-
"interpreter": {
119-
"hash": "586280540a85d3e21edc698fe7b86af2848b9b02644e6c22463da25c40a3f1be"
120-
}
121-
}
125+
"orig_nbformat": 4
122126
},
123127
"nbformat": 4,
124128
"nbformat_minor": 2

0 commit comments

Comments
 (0)