-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput.txt
More file actions
366 lines (348 loc) · 33.5 KB
/
Copy pathoutput.txt
File metadata and controls
366 lines (348 loc) · 33.5 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
=== Install Required Tools ===
[sudo] password for toor:
Hit:1 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu noble-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
27 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3 is already the newest version (3.12.3-0ubuntu2).
The following additional packages will be installed:
libpython3-dev libpython3.12-dev python3-dev python3-pkg-resources
python3-setuptools python3-wheel python3.12-dev python3.12-venv
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libpython3-dev libpython3.12-dev python3-dev python3-pip python3-setuptools
python3-venv python3-wheel python3.12-dev python3.12-venv
The following packages will be upgraded:
python3-pkg-resources
1 upgraded, 9 newly installed, 0 to remove and 27 not upgraded.
Need to get 9,814 kB of archives.
After this operation, 39.2 MB of additional disk space will be used.
Get:1 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble-updates/main amd64 python3-pkg-resources all 68.1.2-2ubuntu1.2 [174 kB]
Get:2 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 python3-setuptools all 68.1.2-2ubuntu1 [752 kB]
Get:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 python3-wheel all 0.42.0-2 [53.1 kB]
Get:4 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble-updates/main amd64 python3-pip all 24.0+dfsg-1ubuntu1.1 [1,367 kB]
Get:5 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 libpython3.12-dev amd64 3.12.3-1ubuntu0.3 [5,672 kB]
Get:6 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 libpython3-dev amd64 3.12.3-0ubuntu2 [10.4 kB]
Get:7 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 python3.12-dev amd64 3.12.3-1ubuntu0.3 [498 kB]
Get:8 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 python3-dev amd64 3.12.3-0ubuntu2 [26.7 kB]
Get:9 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 python3.12-venv amd64 3.12.3-1ubuntu0.3 [5,716 B]
Get:10 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 python3-venv amd64 3.12.3-0ubuntu2 [1,216 B]
Fetched 9,814 kB in 2s (5,084 kB/s)
Selecting previously unselected package python3-setuptools.
(Reading database ... 109781 files and directories currently installed.)
Preparing to unpack .../0-python3-pkg-resources_68.1.2-2ubuntu1.2_all.deb ...
Unpacking python3-pkg-resources (68.1.2-2ubuntu1.2) over (68.1.2-2ubuntu1) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../1-python3-wheel_0.42.0-2_all.deb ...
Unpacking python3-wheel (0.42.0-2) ...
Selecting previously unselected package python3-setuptools.
Preparing to unpack .../2-python3-setuptools_68.1.2-2ubuntu1_all.deb ...
Unpacking python3-setuptools (68.1.2-2ubuntu1) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../3-python3-pip_24.0+dfsg-1ubuntu1.1_all.deb ...
Unpacking python3-pip (24.0+dfsg-1ubuntu1.1) ...
Selecting previously unselected package libpython3.12-dev:amd64.
Preparing to unpack .../4-libpython3.12-dev_3.12.3-1ubuntu0.3_amd64.deb ...
Unpacking libpython3.12-dev:amd64 (3.12.3-1ubuntu0.3) ...
Selecting previously unselected package libpython3-dev:amd64.
Preparing to unpack .../5-libpython3-dev_3.12.3-0ubuntu2_amd64.deb ...
Unpacking libpython3-dev:amd64 (3.12.3-0ubuntu2) ...
Selecting previously unselected package python3.12-dev.
Preparing to unpack .../6-python3.12-dev_3.12.3-1ubuntu0.3_amd64.deb ...
Unpacking python3.12-dev (3.12.3-1ubuntu0.3) ...
Selecting previously unselected package python3-dev.
Preparing to unpack .../7-python3-dev_3.12.3-0ubuntu2_amd64.deb ...
Unpacking python3-dev (3.12.3-0ubuntu2) ...
Selecting previously unselected package python3.12-venv.
Preparing to unpack .../8-python3.12-venv_3.12.3-1ubuntu0.3_amd64.deb ...
Unpacking python3.12-venv (3.12.3-1ubuntu0.3) ...
Selecting previously unselected package python3-venv.
Preparing to unpack .../9-python3-venv_3.12.3-0ubuntu2_amd64.deb ...
Unpacking python3-venv (3.12.3-0ubuntu2) ...
Setting up python3-pkg-resources (68.1.2-2ubuntu1.2) ...
Setting up python3-setuptools (68.1.2-2ubuntu1) ...
Setting up python3-wheel (0.42.0-2) ...
Setting up python3-pip (24.0+dfsg-1ubuntu1.1) ...
Setting up python3.12-venv (3.12.3-1ubuntu0.3) ...
Setting up python3-venv (3.12.3-0ubuntu2) ...
Setting up libpython3.12-dev:amd64 (3.12.3-1ubuntu0.3) ...
Setting up libpython3-dev:amd64 (3.12.3-0ubuntu2) ...
Setting up python3.12-dev (3.12.3-1ubuntu0.3) ...
Setting up python3-dev (3.12.3-0ubuntu2) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.4) ...
/home/toor/logging-lab
Requirement already satisfied: pip in ./venv/lib/python3.12/site-packages (24.0)
Collecting pip
Downloading pip-25.0.1-py3-none-any.whl.metadata (3.7 kB)
Downloading pip-25.0.1-py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 11.7 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 24.0
Uninstalling pip-24.0:
Successfully uninstalled pip-24.0
Successfully installed pip-25.0.1
Collecting flask
Downloading flask-3.1.0-py3-none-any.whl.metadata (2.7 kB)
Collecting python-json-logger
Downloading python_json_logger-3.3.0-py3-none-any.whl.metadata (4.0 kB)
Collecting requests
Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting blinker>=1.9 (from flask)
Downloading blinker-1.9.0-py3-none-any.whl.metadata (1.6 kB)
Collecting click>=8.1.3 (from flask)
Downloading click-8.1.8-py3-none-any.whl.metadata (2.3 kB)
Collecting itsdangerous>=2.2 (from flask)
Downloading itsdangerous-2.2.0-py3-none-any.whl.metadata (1.9 kB)
Collecting jinja2>=3.1.2 (from flask)
Downloading jinja2-3.1.6-py3-none-any.whl.metadata (2.9 kB)
Collecting markupsafe>=2.1.1 (from flask)
Downloading markupsafe-3.0.2-cp312-cp312-manylinux2014_x86_64.whl.metadata (4.0 kB)
Collecting werkzeug>=3.1 (from flask)
Downloading werkzeug-3.1.3-py3-none-any.whl.metadata (3.7 kB)
Collecting charset-normalizer<4,>=2 (from requests)
Downloading charset_normalizer-3.4.1-cp312-cp312-manylinux2014_x86_64.whl.metadata (35 kB)
Collecting idna<4,>=2.5 (from requests)
Downloading idna-3.10-py3-none-any.whl.metadata (10 kB)
Collecting urllib3<3,>=1.21.1 (from requests)
Downloading urllib3-2.3.0-py3-none-any.whl.metadata (6.5 kB)
Collecting certifi>=2017.4.17 (from requests)
Downloading certifi-2025.1.31-py3-none-any.whl.metadata (2.5 kB)
Downloading flask-3.1.0-py3-none-any.whl (102 kB)
Downloading python_json_logger-3.3.0-py3-none-any.whl (15 kB)
Downloading requests-2.32.3-py3-none-any.whl (64 kB)
Downloading blinker-1.9.0-py3-none-any.whl (8.5 kB)
Downloading certifi-2025.1.31-py3-none-any.whl (166 kB)
Downloading charset_normalizer-3.4.1-cp312-cp312-manylinux2014_x86_64.whl (146 kB)
Downloading click-8.1.8-py3-none-any.whl (98 kB)
Downloading idna-3.10-py3-none-any.whl (70 kB)
Downloading itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Downloading jinja2-3.1.6-py3-none-any.whl (134 kB)
Downloading markupsafe-3.0.2-cp312-cp312-manylinux2014_x86_64.whl (23 kB)
Downloading urllib3-2.3.0-py3-none-any.whl (128 kB)
Downloading werkzeug-3.1.3-py3-none-any.whl (224 kB)
Installing collected packages: urllib3, python-json-logger, markupsafe, itsdangerous, idna, click, charset-normalizer, certifi, blinker, werkzeug, requests, jinja2, flask
Successfully installed blinker-1.9.0 certifi-2025.1.31 charset-normalizer-3.4.1 click-8.1.8 flask-3.1.0 idna-3.10 itsdangerous-2.2.0 jinja2-3.1.6 markupsafe-3.0.2 python-json-logger-3.3.0 requests-2.32.3 urllib3-2.3.0 werkzeug-3.1.3
total 16
drwxrwxr-x 3 toor toor 4096 Apr 12 17:03 .
drwxr-x--- 9 toor toor 4096 Apr 12 17:02 ..
drwxrwxr-x 5 toor toor 4096 Apr 12 17:03 venv
=== Step 1: Create Base Application with Structured Logging ===
0
=== Step 2: Test Structured Logging ===
[1] 8014
UID PID PPID C STIME TTY TIME CMD
toor 8014 7842 1 17:09 pts/0 00:00:00 python3 app.py
[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]
{"amount":99.99,"order_id":"5c1d58a1-1de5-4ba6-b218-9708c0d52f3b","user_id":1}
* Serving Flask app 'app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://172.31.10.246:5000
Press CTRL+C to quit
{"timestamp": "2026-04-12T17:09:48.214861+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "3e30e54d-e50d-4342-a5d1-cfbe6ff9b9c7", "message": "Incoming request for users", "method": "GET", "path": "/api/users", "remote_addr": "127.0.0.1"}
{"timestamp": "2026-04-12T17:09:48.315476+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "3e30e54d-e50d-4342-a5d1-cfbe6ff9b9c7", "message": "Users retrieved successfully", "status_code": 200, "user_count": 2, "duration_ms": 100.64}
127.0.0.1 - - [12/Apr/2026 17:09:48] "GET /api/users HTTP/1.1" 200 -
{"timestamp": "2026-04-12T17:10:01.841244+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "c09d61f4-3ca8-4d3b-a816-1a51a4830f1e", "message": "Incoming order creation request", "method": "POST", "path": "/api/orders", "payload_keys": ["user_id", "amount"]}
{"timestamp": "2026-04-12T17:10:01.841420+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "c09d61f4-3ca8-4d3b-a816-1a51a4830f1e", "message": "Order created successfully", "status_code": 201, "order_id": "5c1d58a1-1de5-4ba6-b218-9708c0d52f3b", "user_id": 1, "amount": 99.99, "duration_ms": 0.27}
127.0.0.1 - - [12/Apr/2026 17:10:01] "POST /api/orders HTTP/1.1" 201 -
=== Step 1: Create Downstream Service ===
0
=== Step 2: Update Main Service to Propagate Correlation ID ===
0
=== Step 3: Test Correlation ID Propagation ===
[1] 8182
* Serving Flask app 'service_b'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://127.0.0.1:5001
Press CTRL+C to quit
[2] 8198
* Serving Flask app 'app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
{"order_id":"9dba3ef2-e140-4592-a8a3-3494f1f14735","product_id":"prod-001","status":"confirmed","user_id":1}
* Serving Flask app 'app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
{"timestamp": "2026-04-12T17:17:44.004297+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "test-12345", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:17:44.059544+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "test-12345", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "prod-001", "quantity": 50}}
{"timestamp": "2026-04-12T17:17:44.059792+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "test-12345", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "9dba3ef2-e140-4592-a8a3-3494f1f14735", "product_id": "prod-001", "user_id": 1, "duration_ms": 55.55}
127.0.0.1 - - [12/Apr/2026 17:17:44] "POST /api/orders/full HTTP/1.1" 201 -
* Serving Flask app 'service_b'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://127.0.0.1:5001
Press CTRL+C to quit
{"timestamp": "2026-04-12T17:17:44.008700+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "test-12345", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "prod-001"}
{"timestamp": "2026-04-12T17:17:44.059071+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "test-12345", "message": "Inventory check completed", "status_code": 200, "product_id": "prod-001", "available": true, "quantity": 50, "duration_ms": 50.38}
127.0.0.1 - - [12/Apr/2026 17:17:44] "POST /api/inventory/check HTTP/1.1" 200 -
=== Step 4: Create Log Analysis Script ===
================================================================================
Correlation ID: test-12345
Log Entries : 5
Services : service-a, service-b
Request Flow :
- 2026-04-12T17:17:44.004297+00:00 | service-a | Starting full order workflow
- 2026-04-12T17:17:44.008700+00:00 | service-b | Inventory check request received
- 2026-04-12T17:17:44.059071+00:00 | service-b | Inventory check completed
- 2026-04-12T17:17:44.059544+00:00 | service-a | Inventory check completed in upstream service
- 2026-04-12T17:17:44.059792+00:00 | service-a | Full order workflow completed successfully
=== Verify Structured Logging ===
{"timestamp": "2026-04-12T17:17:44.004297+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "test-12345", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:17:44.059544+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "test-12345", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "prod-001", "quantity": 50}}
{"timestamp": "2026-04-12T17:17:44.059792+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "test-12345", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "9dba3ef2-e140-4592-a8a3-3494f1f14735", "product_id": "prod-001", "user_id": 1, "duration_ms": 55.55}
{"timestamp": "2026-04-12T17:17:44.059792+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "test-12345", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "9dba3ef2-e140-4592-a8a3-3494f1f14735", "product_id": "prod-001", "user_id": 1, "duration_ms": 55.55}
=== Verify Correlation ID Propagation ===
Checking correlation ID propagation...
{"timestamp": "2026-04-12T17:22:11.649593+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:22:11.704952+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "test-prod", "quantity": 50}}
{"timestamp": "2026-04-12T17:22:11.705207+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "f7e0d184-b30c-4830-b9cb-e8bebfdd734a", "product_id": "test-prod", "user_id": 1, "duration_ms": 55.65}
{"timestamp": "2026-04-12T17:22:11.654040+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "verify-1744478531", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "test-prod"}
{"timestamp": "2026-04-12T17:22:11.704498+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "verify-1744478531", "message": "Inventory check completed", "status_code": 200, "product_id": "test-prod", "available": true, "quantity": 50, "duration_ms": 50.45}
toor 8182 0.1 1.1 112320 45444 pts/0 S 17:15 0:00 python3 service_b.py
toor 8198 0.2 1.2 116748 47160 pts/0 S 17:16 0:00 python3 app.py
=== Test Log Traceability ===
================================================================================
Correlation ID: test-12345
Log Entries : 5
Services : service-a, service-b
Request Flow :
- 2026-04-12T17:17:44.004297+00:00 | service-a | Starting full order workflow
- 2026-04-12T17:17:44.008700+00:00 | service-b | Inventory check request received
- 2026-04-12T17:17:44.059071+00:00 | service-b | Inventory check completed
- 2026-04-12T17:17:44.059544+00:00 | service-a | Inventory check completed in upstream service
- 2026-04-12T17:17:44.059792+00:00 | service-a | Full order workflow completed successfully
================================================================================
Correlation ID: verify-1744478531
Log Entries : 5
Services : service-a, service-b
Request Flow :
- 2026-04-12T17:22:11.649593+00:00 | service-a | Starting full order workflow
- 2026-04-12T17:22:11.654040+00:00 | service-b | Inventory check request received
- 2026-04-12T17:22:11.704498+00:00 | service-b | Inventory check completed
- 2026-04-12T17:22:11.704952+00:00 | service-a | Inventory check completed in upstream service
- 2026-04-12T17:22:11.705207+00:00 | service-a | Full order workflow completed successfully
================================================================================
Correlation ID: 094a1f57-5771-42c5-9c56-0fb558d928fa
Log Entries : 5
Services : service-a, service-b
Request Flow :
- 2026-04-12T17:23:29.119174+00:00 | service-a | Starting full order workflow
- 2026-04-12T17:23:29.123660+00:00 | service-b | Inventory check request received
- 2026-04-12T17:23:29.174118+00:00 | service-b | Inventory check completed
- 2026-04-12T17:23:29.174684+00:00 | service-a | Inventory check completed in upstream service
- 2026-04-12T17:23:29.174928+00:00 | service-a | Full order workflow completed successfully
================================================================================
Correlation ID: a8e52f6f-44fe-4e1b-9883-833c3f58542f
Log Entries : 5
Services : service-a, service-b
Request Flow :
- 2026-04-12T17:23:30.186350+00:00 | service-a | Starting full order workflow
- 2026-04-12T17:23:30.190916+00:00 | service-b | Inventory check request received
- 2026-04-12T17:23:30.241279+00:00 | service-b | Inventory check completed
- 2026-04-12T17:23:30.241795+00:00 | service-a | Inventory check completed in upstream service
- 2026-04-12T17:23:30.242016+00:00 | service-a | Full order workflow completed successfully
================================================================================
Correlation ID: 64c5b11f-14db-4c1b-a980-c4ed5d46a548
Log Entries : 5
Services : service-a, service-b
Request Flow :
- 2026-04-12T17:23:31.252961+00:00 | service-a | Starting full order workflow
- 2026-04-12T17:23:31.257503+00:00 | service-b | Inventory check request received
- 2026-04-12T17:23:31.307844+00:00 | service-b | Inventory check completed
- 2026-04-12T17:23:31.308363+00:00 | service-a | Inventory check completed in upstream service
- 2026-04-12T17:23:31.308595+00:00 | service-a | Full order workflow completed successfully
=== Logs not in JSON format ===
Name: python-json-logger
Version: 3.3.0
Summary: JSON Log Formatter for the Python Logging Package
Home-page:
Author:
Author-email:
License: BSD-2-Clause License
Location: /home/toor/logging-lab/venv/lib/python3.12/site-packages
Requires:
Required-by:
=== Correlation ID not propagating ===
{"timestamp": "2026-04-12T17:22:11.649593+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:22:11.704952+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "test-prod", "quantity": 50}}
{"timestamp": "2026-04-12T17:22:11.705207+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "f7e0d184-b30c-4830-b9cb-e8bebfdd734a", "product_id": "test-prod", "user_id": 1, "duration_ms": 55.65}
127.0.0.1 - - [12/Apr/2026 17:22:11] "POST /api/orders/full HTTP/1.1" 201 -
{"timestamp": "2026-04-12T17:23:29.119174+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:23:29.174684+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "prod-1", "quantity": 50}}
{"timestamp": "2026-04-12T17:23:29.174928+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "77db17d7-094c-4d16-8817-58ccd0c893bd", "product_id": "prod-1", "user_id": 1, "duration_ms": 55.78}
{"timestamp": "2026-04-12T17:23:30.186350+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:23:30.241795+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "prod-2", "quantity": 50}}
{"timestamp": "2026-04-12T17:23:30.242016+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "b80ce30b-486b-4714-b31a-06cd51e7ac85", "product_id": "prod-2", "user_id": 2, "duration_ms": 55.67}
{"timestamp": "2026-04-12T17:23:31.252961+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:23:31.308363+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "prod-3", "quantity": 50}}
{"timestamp": "2026-04-12T17:23:31.308595+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "43f492fc-f6ae-4ded-a6ca-ab9a613f3f38", "product_id": "prod-3", "user_id": 3, "duration_ms": 55.64}
{"timestamp": "2026-04-12T17:22:11.654040+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "verify-1744478531", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "test-prod"}
{"timestamp": "2026-04-12T17:22:11.704498+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "verify-1744478531", "message": "Inventory check completed", "status_code": 200, "product_id": "test-prod", "available": true, "quantity": 50, "duration_ms": 50.45}
127.0.0.1 - - [12/Apr/2026 17:22:11] "POST /api/inventory/check HTTP/1.1" 200 -
{"timestamp": "2026-04-12T17:23:29.123660+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "prod-1"}
{"timestamp": "2026-04-12T17:23:29.174118+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Inventory check completed", "status_code": 200, "product_id": "prod-1", "available": true, "quantity": 50, "duration_ms": 50.42}
127.0.0.1 - - [12/Apr/2026 17:23:29] "POST /api/inventory/check HTTP/1.1" 200 -
{"timestamp": "2026-04-12T17:23:30.190916+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "prod-2"}
{"timestamp": "2026-04-12T17:23:30.241279+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Inventory check completed", "status_code": 200, "product_id": "prod-2", "available": true, "quantity": 50, "duration_ms": 50.39}
127.0.0.1 - - [12/Apr/2026 17:23:30] "POST /api/inventory/check HTTP/1.1" 200 -
{"timestamp": "2026-04-12T17:23:31.257503+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "prod-3"}
{"timestamp": "2026-04-12T17:23:31.307844+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Inventory check completed", "status_code": 200, "product_id": "prod-3", "available": true, "quantity": 50, "duration_ms": 50.37}
127.0.0.1 - - [12/Apr/2026 17:23:31] "POST /api/inventory/check HTTP/1.1" 200 -
=== Services not responding ===
LISTEN 0 128 0.0.0.0:5000 0.0.0.0:* users:(("python3",pid=8198,fd=3))
LISTEN 0 128 0.0.0.0:5001 0.0.0.0:* users:(("python3",pid=8182,fd=3))
toor 8182 0.1 1.1 112320 45444 pts/0 S 17:15 0:00 python3 service_b.py
toor 8198 0.2 1.2 116748 47160 pts/0 S 17:16 0:00 python3 app.py
{"timestamp": "2026-04-12T17:22:11.649593+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:22:11.704952+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "test-prod", "quantity": 50}}
{"timestamp": "2026-04-12T17:22:11.705207+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "verify-1744478531", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "f7e0d184-b30c-4830-b9cb-e8bebfdd734a", "product_id": "test-prod", "user_id": 1, "duration_ms": 55.65}
127.0.0.1 - - [12/Apr/2026 17:22:11] "POST /api/orders/full HTTP/1.1" 201 -
{"timestamp": "2026-04-12T17:23:29.119174+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:23:29.174684+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "prod-1", "quantity": 50}}
{"timestamp": "2026-04-12T17:23:29.174928+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "77db17d7-094c-4d16-8817-58ccd0c893bd", "product_id": "prod-1", "user_id": 1, "duration_ms": 55.78}
{"timestamp": "2026-04-12T17:23:30.186350+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:23:30.241795+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "prod-2", "quantity": 50}}
{"timestamp": "2026-04-12T17:23:30.242016+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "b80ce30b-486b-4714-b31a-06cd51e7ac85", "product_id": "prod-2", "user_id": 2, "duration_ms": 55.67}
{"timestamp": "2026-04-12T17:23:31.252961+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Starting full order workflow", "method": "POST", "path": "/api/orders/full", "payload_keys": ["product_id", "user_id"]}
{"timestamp": "2026-04-12T17:23:31.308363+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Inventory check completed in upstream service", "inventory_result": {"available": true, "product_id": "prod-3", "quantity": 50}}
{"timestamp": "2026-04-12T17:23:31.308595+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "43f492fc-f6ae-4ded-a6ca-ab9a613f3f38", "product_id": "prod-3", "user_id": 3, "duration_ms": 55.64}
{"timestamp": "2026-04-12T17:22:11.654040+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "verify-1744478531", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "test-prod"}
{"timestamp": "2026-04-12T17:22:11.704498+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "verify-1744478531", "message": "Inventory check completed", "status_code": 200, "product_id": "test-prod", "available": true, "quantity": 50, "duration_ms": 50.45}
127.0.0.1 - - [12/Apr/2026 17:22:11] "POST /api/inventory/check HTTP/1.1" 200 -
{"timestamp": "2026-04-12T17:23:29.123660+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "prod-1"}
{"timestamp": "2026-04-12T17:23:29.174118+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "094a1f57-5771-42c5-9c56-0fb558d928fa", "message": "Inventory check completed", "status_code": 200, "product_id": "prod-1", "available": true, "quantity": 50, "duration_ms": 50.42}
127.0.0.1 - - [12/Apr/2026 17:23:29] "POST /api/inventory/check HTTP/1.1" 200 -
{"timestamp": "2026-04-12T17:23:30.190916+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "prod-2"}
{"timestamp": "2026-04-12T17:23:30.241279+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "a8e52f6f-44fe-4e1b-9883-833c3f58542f", "message": "Inventory check completed", "status_code": 200, "product_id": "prod-2", "available": true, "quantity": 50, "duration_ms": 50.39}
127.0.0.1 - - [12/Apr/2026 17:23:30] "POST /api/inventory/check HTTP/1.1" 200 -
{"timestamp": "2026-04-12T17:23:31.257503+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Inventory check request received", "method": "POST", "path": "/api/inventory/check", "product_id": "prod-3"}
{"timestamp": "2026-04-12T17:23:31.307844+00:00", "level": "INFO", "name": "service-b", "service": "service-b", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Inventory check completed", "status_code": 200, "product_id": "prod-3", "available": true, "quantity": 50, "duration_ms": 50.37}
127.0.0.1 - - [12/Apr/2026 17:23:31] "POST /api/inventory/check HTTP/1.1" 200 -
=== Missing log fields ===
{"timestamp": "2026-04-12T17:23:31.308595+00:00", "level": "INFO", "name": "service-a", "service": "service-a", "correlation_id": "64c5b11f-14db-4c1b-a980-c4ed5d46a548", "message": "Full order workflow completed successfully", "status_code": 201, "order_id": "43f492fc-f6ae-4ded-a6ca-ab9a613f3f38", "product_id": "prod-3", "user_id": 3, "duration_ms": 55.64}
=== Final Project Snapshot ===
./analyze_logs.py
./app.log
./app.py
./combined.log
./service_b.log
./service_b.py
[1]- 8182 Running python3 service_b.py > service_b.log 2>&1 &
[2]+ 8198 Running python3 app.py > app.log 2>&1 &