mikroscope 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1433 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "MikroScope API",
5
+ "version": "0.1.0",
6
+ "description": "HTTP API for ingesting, indexing, querying, and operating MikroScope logs.\n\nAuthentication behavior is runtime-configurable:\n- `/api/reindex`, `/api/logs`, `/api/logs/aggregate` require Bearer API token and/or Basic auth only if enabled.\n- `/api/ingest` requires producer Bearer token mapping and/or Basic auth username (used as `producerId`) when enabled.\n\nIf no auth is configured for a route category, that category is open.\n"
7
+ },
8
+ "servers": [
9
+ {
10
+ "url": "http://127.0.0.1:4310",
11
+ "description": "Default local HTTP server"
12
+ },
13
+ {
14
+ "url": "https://127.0.0.1:4310",
15
+ "description": "Local HTTPS server (when TLS is configured)"
16
+ }
17
+ ],
18
+ "tags": [
19
+ {
20
+ "name": "Health"
21
+ },
22
+ {
23
+ "name": "Ingest"
24
+ },
25
+ {
26
+ "name": "Logs"
27
+ },
28
+ {
29
+ "name": "Admin"
30
+ }
31
+ ],
32
+ "paths": {
33
+ "/health": {
34
+ "options": {
35
+ "tags": [
36
+ "Health"
37
+ ],
38
+ "summary": "CORS preflight",
39
+ "operationId": "preflightHealth",
40
+ "security": [
41
+
42
+ ],
43
+ "responses": {
44
+ "204": {
45
+ "description": "No Content"
46
+ }
47
+ }
48
+ },
49
+ "get": {
50
+ "tags": [
51
+ "Health"
52
+ ],
53
+ "summary": "Service health and runtime status",
54
+ "operationId": "getHealth",
55
+ "security": [
56
+
57
+ ],
58
+ "responses": {
59
+ "200": {
60
+ "description": "Runtime health snapshot",
61
+ "content": {
62
+ "application/json": {
63
+ "schema": {
64
+ "$ref": "#/components/schemas/HealthResponse"
65
+ }
66
+ }
67
+ }
68
+ },
69
+ "500": {
70
+ "$ref": "#/components/responses/InternalError"
71
+ }
72
+ }
73
+ }
74
+ },
75
+ "/api/ingest": {
76
+ "options": {
77
+ "tags": [
78
+ "Ingest"
79
+ ],
80
+ "summary": "CORS preflight",
81
+ "operationId": "preflightIngest",
82
+ "security": [
83
+
84
+ ],
85
+ "responses": {
86
+ "204": {
87
+ "description": "No Content"
88
+ }
89
+ }
90
+ },
91
+ "post": {
92
+ "tags": [
93
+ "Ingest"
94
+ ],
95
+ "summary": "Ingest log records",
96
+ "operationId": "ingestLogs",
97
+ "description": "Accepts logs as either:\n- A top-level JSON array\n- An object wrapper `{ \"logs\": [...] }`\n\n`producerId` is always resolved from auth context, not trusted from payload.\n- Bearer token is resolved via producer mapping (`token=producerId`).\n- Basic auth uses the authenticated username as `producerId`.\n\nNon-object log items are rejected per-item (`rejected` count) while valid objects are accepted.\n",
98
+ "security": [
99
+ {
100
+ "producerBearerAuth": [
101
+
102
+ ]
103
+ },
104
+ {
105
+ "basicAuth": [
106
+
107
+ ]
108
+ }
109
+ ],
110
+ "requestBody": {
111
+ "required": true,
112
+ "content": {
113
+ "application/json": {
114
+ "schema": {
115
+ "$ref": "#/components/schemas/IngestRequest"
116
+ },
117
+ "examples": {
118
+ "arrayPayload": {
119
+ "summary": "Top-level array payload",
120
+ "value": [
121
+ {
122
+ "timestamp": "2026-02-18T12:10:00.000Z",
123
+ "level": "INFO",
124
+ "event": "frontend.pageview",
125
+ "message": "frontend.pageview",
126
+ "producerId": "ignored"
127
+ },
128
+ "invalid-item"
129
+ ]
130
+ },
131
+ "wrappedPayload": {
132
+ "summary": "Wrapper payload",
133
+ "value": {
134
+ "logs": [
135
+ {
136
+ "timestamp": "2026-02-18T12:10:00.000Z",
137
+ "level": "INFO",
138
+ "event": "frontend.click",
139
+ "message": "frontend.click"
140
+ }
141
+ ]
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
147
+ },
148
+ "responses": {
149
+ "200": {
150
+ "description": "Ingested and flushed/indexed synchronously",
151
+ "content": {
152
+ "application/json": {
153
+ "schema": {
154
+ "$ref": "#/components/schemas/IngestResponse"
155
+ }
156
+ }
157
+ }
158
+ },
159
+ "202": {
160
+ "description": "Accepted and queued (async queue enabled)",
161
+ "content": {
162
+ "application/json": {
163
+ "schema": {
164
+ "$ref": "#/components/schemas/IngestResponse"
165
+ }
166
+ }
167
+ }
168
+ },
169
+ "400": {
170
+ "description": "Invalid JSON or invalid ingest payload structure",
171
+ "content": {
172
+ "application/json": {
173
+ "schema": {
174
+ "$ref": "#/components/schemas/ErrorResponse"
175
+ },
176
+ "examples": {
177
+ "invalidJson": {
178
+ "value": {
179
+ "error": "Invalid JSON payload."
180
+ }
181
+ },
182
+ "invalidPayload": {
183
+ "value": {
184
+ "error": "Invalid ingest payload. Expected an array or an object with a logs array."
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
190
+ },
191
+ "401": {
192
+ "$ref": "#/components/responses/Unauthorized"
193
+ },
194
+ "404": {
195
+ "description": "Ingest endpoint disabled",
196
+ "content": {
197
+ "application/json": {
198
+ "schema": {
199
+ "$ref": "#/components/schemas/ErrorResponse"
200
+ },
201
+ "example": {
202
+ "error": "Ingest endpoint is not enabled."
203
+ }
204
+ }
205
+ }
206
+ },
207
+ "413": {
208
+ "description": "Payload too large",
209
+ "content": {
210
+ "application/json": {
211
+ "schema": {
212
+ "$ref": "#/components/schemas/ErrorResponse"
213
+ },
214
+ "example": {
215
+ "error": "Payload too large. Max body size is 1048576 bytes."
216
+ }
217
+ }
218
+ }
219
+ },
220
+ "500": {
221
+ "$ref": "#/components/responses/InternalError"
222
+ }
223
+ }
224
+ }
225
+ },
226
+ "/api/reindex": {
227
+ "options": {
228
+ "tags": [
229
+ "Admin"
230
+ ],
231
+ "summary": "CORS preflight",
232
+ "operationId": "preflightReindex",
233
+ "security": [
234
+
235
+ ],
236
+ "responses": {
237
+ "204": {
238
+ "description": "No Content"
239
+ }
240
+ }
241
+ },
242
+ "post": {
243
+ "tags": [
244
+ "Admin"
245
+ ],
246
+ "summary": "Rebuild DB index from current logs",
247
+ "operationId": "reindexLogs",
248
+ "description": "Resets the DB, then performs full indexing from the configured logs directory.",
249
+ "security": [
250
+ {
251
+ "apiBearerAuth": [
252
+
253
+ ]
254
+ },
255
+ {
256
+ "basicAuth": [
257
+
258
+ ]
259
+ }
260
+ ],
261
+ "responses": {
262
+ "200": {
263
+ "description": "Reindex completed",
264
+ "content": {
265
+ "application/json": {
266
+ "schema": {
267
+ "$ref": "#/components/schemas/ReindexResponse"
268
+ }
269
+ }
270
+ }
271
+ },
272
+ "401": {
273
+ "$ref": "#/components/responses/Unauthorized"
274
+ },
275
+ "500": {
276
+ "$ref": "#/components/responses/InternalError"
277
+ }
278
+ }
279
+ }
280
+ },
281
+ "/api/logs": {
282
+ "options": {
283
+ "tags": [
284
+ "Logs"
285
+ ],
286
+ "summary": "CORS preflight",
287
+ "operationId": "preflightLogs",
288
+ "security": [
289
+
290
+ ],
291
+ "responses": {
292
+ "204": {
293
+ "description": "No Content"
294
+ }
295
+ }
296
+ },
297
+ "get": {
298
+ "tags": [
299
+ "Logs"
300
+ ],
301
+ "summary": "Query paginated logs",
302
+ "operationId": "queryLogs",
303
+ "security": [
304
+ {
305
+ "apiBearerAuth": [
306
+
307
+ ]
308
+ },
309
+ {
310
+ "basicAuth": [
311
+
312
+ ]
313
+ }
314
+ ],
315
+ "parameters": [
316
+ {
317
+ "$ref": "#/components/parameters/From"
318
+ },
319
+ {
320
+ "$ref": "#/components/parameters/To"
321
+ },
322
+ {
323
+ "$ref": "#/components/parameters/Level"
324
+ },
325
+ {
326
+ "$ref": "#/components/parameters/Audit"
327
+ },
328
+ {
329
+ "$ref": "#/components/parameters/Field"
330
+ },
331
+ {
332
+ "$ref": "#/components/parameters/Value"
333
+ },
334
+ {
335
+ "$ref": "#/components/parameters/Limit"
336
+ },
337
+ {
338
+ "$ref": "#/components/parameters/Cursor"
339
+ }
340
+ ],
341
+ "responses": {
342
+ "200": {
343
+ "description": "Page of indexed logs",
344
+ "content": {
345
+ "application/json": {
346
+ "schema": {
347
+ "$ref": "#/components/schemas/LogQueryPage"
348
+ }
349
+ }
350
+ }
351
+ },
352
+ "401": {
353
+ "$ref": "#/components/responses/Unauthorized"
354
+ },
355
+ "500": {
356
+ "$ref": "#/components/responses/InternalError"
357
+ }
358
+ }
359
+ }
360
+ },
361
+ "/api/logs/aggregate": {
362
+ "options": {
363
+ "tags": [
364
+ "Logs"
365
+ ],
366
+ "summary": "CORS preflight",
367
+ "operationId": "preflightAggregateLogs",
368
+ "security": [
369
+
370
+ ],
371
+ "responses": {
372
+ "204": {
373
+ "description": "No Content"
374
+ }
375
+ }
376
+ },
377
+ "get": {
378
+ "tags": [
379
+ "Logs"
380
+ ],
381
+ "summary": "Aggregate logs by level/event/field/correlation",
382
+ "operationId": "aggregateLogs",
383
+ "security": [
384
+ {
385
+ "apiBearerAuth": [
386
+
387
+ ]
388
+ },
389
+ {
390
+ "basicAuth": [
391
+
392
+ ]
393
+ }
394
+ ],
395
+ "parameters": [
396
+ {
397
+ "$ref": "#/components/parameters/From"
398
+ },
399
+ {
400
+ "$ref": "#/components/parameters/To"
401
+ },
402
+ {
403
+ "$ref": "#/components/parameters/Level"
404
+ },
405
+ {
406
+ "$ref": "#/components/parameters/Audit"
407
+ },
408
+ {
409
+ "$ref": "#/components/parameters/Field"
410
+ },
411
+ {
412
+ "$ref": "#/components/parameters/Value"
413
+ },
414
+ {
415
+ "$ref": "#/components/parameters/Limit"
416
+ },
417
+ {
418
+ "$ref": "#/components/parameters/GroupBy"
419
+ },
420
+ {
421
+ "$ref": "#/components/parameters/GroupField"
422
+ }
423
+ ],
424
+ "responses": {
425
+ "200": {
426
+ "description": "Aggregation result",
427
+ "content": {
428
+ "application/json": {
429
+ "schema": {
430
+ "$ref": "#/components/schemas/AggregateResponse"
431
+ }
432
+ }
433
+ }
434
+ },
435
+ "400": {
436
+ "description": "Invalid aggregation parameters",
437
+ "content": {
438
+ "application/json": {
439
+ "schema": {
440
+ "$ref": "#/components/schemas/ErrorResponse"
441
+ },
442
+ "examples": {
443
+ "invalidGroupBy": {
444
+ "value": {
445
+ "error": "Invalid groupBy. Expected level, event, field, or correlation."
446
+ }
447
+ },
448
+ "missingGroupField": {
449
+ "value": {
450
+ "error": "Missing required groupField when groupBy=field."
451
+ }
452
+ }
453
+ }
454
+ }
455
+ }
456
+ },
457
+ "401": {
458
+ "$ref": "#/components/responses/Unauthorized"
459
+ },
460
+ "500": {
461
+ "$ref": "#/components/responses/InternalError"
462
+ }
463
+ }
464
+ }
465
+ }
466
+ },
467
+ "components": {
468
+ "securitySchemes": {
469
+ "apiBearerAuth": {
470
+ "type": "http",
471
+ "scheme": "bearer",
472
+ "bearerFormat": "Token",
473
+ "description": "Bearer API token for query/admin routes (`MIKROSCOPE_API_TOKEN`)."
474
+ },
475
+ "producerBearerAuth": {
476
+ "type": "http",
477
+ "scheme": "bearer",
478
+ "bearerFormat": "Token",
479
+ "description": "Bearer producer token mapped via ingest producer mapping (`token=producerId`)."
480
+ },
481
+ "basicAuth": {
482
+ "type": "http",
483
+ "scheme": "basic",
484
+ "description": "Basic auth for API and ingest routes when username/password is configured."
485
+ }
486
+ },
487
+ "parameters": {
488
+ "From": {
489
+ "name": "from",
490
+ "in": "query",
491
+ "required": false,
492
+ "description": "Inclusive lower timestamp bound (ISO-8601).",
493
+ "schema": {
494
+ "type": "string",
495
+ "format": "date-time"
496
+ }
497
+ },
498
+ "To": {
499
+ "name": "to",
500
+ "in": "query",
501
+ "required": false,
502
+ "description": "Inclusive upper timestamp bound (ISO-8601).",
503
+ "schema": {
504
+ "type": "string",
505
+ "format": "date-time"
506
+ }
507
+ },
508
+ "Level": {
509
+ "name": "level",
510
+ "in": "query",
511
+ "required": false,
512
+ "description": "Log level filter (normalized to uppercase by server).",
513
+ "schema": {
514
+ "type": "string"
515
+ }
516
+ },
517
+ "Audit": {
518
+ "name": "audit",
519
+ "in": "query",
520
+ "required": false,
521
+ "description": "Audit filter. Supported values: `true`, `false`, `1`, `0`.",
522
+ "schema": {
523
+ "type": "string",
524
+ "enum": [
525
+ "true",
526
+ "false",
527
+ "1",
528
+ "0"
529
+ ]
530
+ }
531
+ },
532
+ "Field": {
533
+ "name": "field",
534
+ "in": "query",
535
+ "required": false,
536
+ "description": "Top-level field key filter (applies when `value` is also set).",
537
+ "schema": {
538
+ "type": "string"
539
+ }
540
+ },
541
+ "Value": {
542
+ "name": "value",
543
+ "in": "query",
544
+ "required": false,
545
+ "description": "Top-level field value filter (applies when `field` is also set).",
546
+ "schema": {
547
+ "type": "string"
548
+ }
549
+ },
550
+ "Limit": {
551
+ "name": "limit",
552
+ "in": "query",
553
+ "required": false,
554
+ "description": "Max rows/buckets. Default 100 for logs, 25 for aggregate. Hard cap 1000.",
555
+ "schema": {
556
+ "type": "integer",
557
+ "minimum": 1,
558
+ "maximum": 1000,
559
+ "default": 100
560
+ }
561
+ },
562
+ "Cursor": {
563
+ "name": "cursor",
564
+ "in": "query",
565
+ "required": false,
566
+ "description": "Cursor token from a previous `/api/logs` response.",
567
+ "schema": {
568
+ "type": "string"
569
+ }
570
+ },
571
+ "GroupBy": {
572
+ "name": "groupBy",
573
+ "in": "query",
574
+ "required": true,
575
+ "description": "Aggregation dimension.",
576
+ "schema": {
577
+ "type": "string",
578
+ "enum": [
579
+ "level",
580
+ "event",
581
+ "field",
582
+ "correlation"
583
+ ]
584
+ }
585
+ },
586
+ "GroupField": {
587
+ "name": "groupField",
588
+ "in": "query",
589
+ "required": false,
590
+ "description": "Required when `groupBy=field`.",
591
+ "schema": {
592
+ "type": "string"
593
+ }
594
+ }
595
+ },
596
+ "responses": {
597
+ "Unauthorized": {
598
+ "description": "Unauthorized",
599
+ "content": {
600
+ "application/json": {
601
+ "schema": {
602
+ "$ref": "#/components/schemas/ErrorResponse"
603
+ },
604
+ "example": {
605
+ "error": "Unauthorized"
606
+ }
607
+ }
608
+ }
609
+ },
610
+ "InternalError": {
611
+ "description": "Internal server error",
612
+ "content": {
613
+ "application/json": {
614
+ "schema": {
615
+ "$ref": "#/components/schemas/ErrorResponse"
616
+ }
617
+ }
618
+ }
619
+ }
620
+ },
621
+ "schemas": {
622
+ "ErrorResponse": {
623
+ "type": "object",
624
+ "additionalProperties": false,
625
+ "required": [
626
+ "error"
627
+ ],
628
+ "properties": {
629
+ "error": {
630
+ "type": "string"
631
+ }
632
+ }
633
+ },
634
+ "IngestRequest": {
635
+ "oneOf": [
636
+ {
637
+ "type": "array",
638
+ "items": {
639
+ }
640
+ },
641
+ {
642
+ "type": "object",
643
+ "required": [
644
+ "logs"
645
+ ],
646
+ "properties": {
647
+ "logs": {
648
+ "type": "array",
649
+ "items": {
650
+ }
651
+ }
652
+ },
653
+ "additionalProperties": true
654
+ }
655
+ ]
656
+ },
657
+ "IngestResponse": {
658
+ "type": "object",
659
+ "additionalProperties": false,
660
+ "required": [
661
+ "accepted",
662
+ "queued",
663
+ "producerId",
664
+ "receivedAt",
665
+ "rejected"
666
+ ],
667
+ "properties": {
668
+ "accepted": {
669
+ "type": "integer",
670
+ "minimum": 0
671
+ },
672
+ "queued": {
673
+ "type": "boolean"
674
+ },
675
+ "producerId": {
676
+ "type": "string"
677
+ },
678
+ "receivedAt": {
679
+ "type": "string",
680
+ "format": "date-time"
681
+ },
682
+ "rejected": {
683
+ "type": "integer",
684
+ "minimum": 0
685
+ }
686
+ }
687
+ },
688
+ "ResetResult": {
689
+ "type": "object",
690
+ "additionalProperties": false,
691
+ "required": [
692
+ "entriesDeleted",
693
+ "fieldsDeleted"
694
+ ],
695
+ "properties": {
696
+ "entriesDeleted": {
697
+ "type": "integer",
698
+ "minimum": 0
699
+ },
700
+ "fieldsDeleted": {
701
+ "type": "integer",
702
+ "minimum": 0
703
+ }
704
+ }
705
+ },
706
+ "IndexReport": {
707
+ "type": "object",
708
+ "additionalProperties": false,
709
+ "required": [
710
+ "filesScanned",
711
+ "linesScanned",
712
+ "recordsInserted",
713
+ "recordsSkipped",
714
+ "parseErrors",
715
+ "startedAt",
716
+ "finishedAt"
717
+ ],
718
+ "properties": {
719
+ "filesScanned": {
720
+ "type": "integer",
721
+ "minimum": 0
722
+ },
723
+ "linesScanned": {
724
+ "type": "integer",
725
+ "minimum": 0
726
+ },
727
+ "recordsInserted": {
728
+ "type": "integer",
729
+ "minimum": 0
730
+ },
731
+ "recordsSkipped": {
732
+ "type": "integer",
733
+ "minimum": 0
734
+ },
735
+ "parseErrors": {
736
+ "type": "integer",
737
+ "minimum": 0
738
+ },
739
+ "startedAt": {
740
+ "type": "string",
741
+ "format": "date-time"
742
+ },
743
+ "finishedAt": {
744
+ "type": "string",
745
+ "format": "date-time"
746
+ },
747
+ "mode": {
748
+ "type": "string",
749
+ "enum": [
750
+ "full",
751
+ "incremental"
752
+ ]
753
+ }
754
+ }
755
+ },
756
+ "ReindexResponse": {
757
+ "type": "object",
758
+ "additionalProperties": false,
759
+ "required": [
760
+ "report",
761
+ "reset"
762
+ ],
763
+ "properties": {
764
+ "report": {
765
+ "$ref": "#/components/schemas/IndexReport"
766
+ },
767
+ "reset": {
768
+ "$ref": "#/components/schemas/ResetResult"
769
+ }
770
+ }
771
+ },
772
+ "LogRecord": {
773
+ "type": "object",
774
+ "description": "Original JSON log object as indexed/ingested.",
775
+ "additionalProperties": true
776
+ },
777
+ "LogEntry": {
778
+ "type": "object",
779
+ "additionalProperties": false,
780
+ "required": [
781
+ "id",
782
+ "timestamp",
783
+ "level",
784
+ "event",
785
+ "message",
786
+ "data",
787
+ "sourceFile",
788
+ "lineNumber"
789
+ ],
790
+ "properties": {
791
+ "id": {
792
+ "type": "integer",
793
+ "minimum": 1
794
+ },
795
+ "timestamp": {
796
+ "type": "string",
797
+ "format": "date-time"
798
+ },
799
+ "level": {
800
+ "type": "string"
801
+ },
802
+ "event": {
803
+ "type": "string"
804
+ },
805
+ "message": {
806
+ "type": "string"
807
+ },
808
+ "data": {
809
+ "$ref": "#/components/schemas/LogRecord"
810
+ },
811
+ "sourceFile": {
812
+ "type": "string"
813
+ },
814
+ "lineNumber": {
815
+ "type": "integer",
816
+ "minimum": 1
817
+ }
818
+ }
819
+ },
820
+ "LogQueryPage": {
821
+ "type": "object",
822
+ "additionalProperties": false,
823
+ "required": [
824
+ "entries",
825
+ "hasMore",
826
+ "limit"
827
+ ],
828
+ "properties": {
829
+ "entries": {
830
+ "type": "array",
831
+ "items": {
832
+ "$ref": "#/components/schemas/LogEntry"
833
+ }
834
+ },
835
+ "hasMore": {
836
+ "type": "boolean"
837
+ },
838
+ "limit": {
839
+ "type": "integer",
840
+ "minimum": 1,
841
+ "maximum": 1000
842
+ },
843
+ "nextCursor": {
844
+ "type": "string"
845
+ }
846
+ }
847
+ },
848
+ "AggregateBucket": {
849
+ "type": "object",
850
+ "additionalProperties": false,
851
+ "required": [
852
+ "key",
853
+ "count"
854
+ ],
855
+ "properties": {
856
+ "key": {
857
+ "type": "string"
858
+ },
859
+ "count": {
860
+ "type": "integer",
861
+ "minimum": 0
862
+ }
863
+ }
864
+ },
865
+ "AggregateResponse": {
866
+ "type": "object",
867
+ "additionalProperties": false,
868
+ "required": [
869
+ "buckets",
870
+ "groupBy"
871
+ ],
872
+ "properties": {
873
+ "buckets": {
874
+ "type": "array",
875
+ "items": {
876
+ "$ref": "#/components/schemas/AggregateBucket"
877
+ }
878
+ },
879
+ "groupBy": {
880
+ "type": "string",
881
+ "enum": [
882
+ "level",
883
+ "event",
884
+ "field",
885
+ "correlation"
886
+ ]
887
+ },
888
+ "groupField": {
889
+ "type": "string"
890
+ }
891
+ }
892
+ },
893
+ "IngestState": {
894
+ "type": "object",
895
+ "additionalProperties": false,
896
+ "required": [
897
+ "running",
898
+ "runs",
899
+ "recordsInsertedLastRun",
900
+ "recordsInsertedTotal",
901
+ "recordsSkippedLastRun",
902
+ "recordsSkippedTotal",
903
+ "parseErrorsLastRun",
904
+ "parseErrorsTotal",
905
+ "linesScannedLastRun",
906
+ "linesScannedTotal",
907
+ "filesScannedLastRun",
908
+ "filesScannedTotal"
909
+ ],
910
+ "properties": {
911
+ "running": {
912
+ "type": "boolean"
913
+ },
914
+ "runs": {
915
+ "type": "integer",
916
+ "minimum": 0
917
+ },
918
+ "lastRunAt": {
919
+ "type": "string",
920
+ "format": "date-time"
921
+ },
922
+ "lastSuccessAt": {
923
+ "type": "string",
924
+ "format": "date-time"
925
+ },
926
+ "lastDurationMs": {
927
+ "type": "number",
928
+ "minimum": 0
929
+ },
930
+ "lastError": {
931
+ "type": "string"
932
+ },
933
+ "recordsInsertedLastRun": {
934
+ "type": "integer",
935
+ "minimum": 0
936
+ },
937
+ "recordsInsertedTotal": {
938
+ "type": "integer",
939
+ "minimum": 0
940
+ },
941
+ "recordsSkippedLastRun": {
942
+ "type": "integer",
943
+ "minimum": 0
944
+ },
945
+ "recordsSkippedTotal": {
946
+ "type": "integer",
947
+ "minimum": 0
948
+ },
949
+ "parseErrorsLastRun": {
950
+ "type": "integer",
951
+ "minimum": 0
952
+ },
953
+ "parseErrorsTotal": {
954
+ "type": "integer",
955
+ "minimum": 0
956
+ },
957
+ "linesScannedLastRun": {
958
+ "type": "integer",
959
+ "minimum": 0
960
+ },
961
+ "linesScannedTotal": {
962
+ "type": "integer",
963
+ "minimum": 0
964
+ },
965
+ "filesScannedLastRun": {
966
+ "type": "integer",
967
+ "minimum": 0
968
+ },
969
+ "filesScannedTotal": {
970
+ "type": "integer",
971
+ "minimum": 0
972
+ },
973
+ "lastMode": {
974
+ "type": "string",
975
+ "enum": [
976
+ "full",
977
+ "incremental"
978
+ ]
979
+ }
980
+ }
981
+ },
982
+ "IngestPolicy": {
983
+ "type": "object",
984
+ "additionalProperties": false,
985
+ "required": [
986
+ "enabled",
987
+ "intervalMs"
988
+ ],
989
+ "properties": {
990
+ "enabled": {
991
+ "type": "boolean"
992
+ },
993
+ "intervalMs": {
994
+ "type": "number",
995
+ "minimum": 0
996
+ }
997
+ }
998
+ },
999
+ "IngestQueueHealth": {
1000
+ "type": "object",
1001
+ "additionalProperties": false,
1002
+ "required": [
1003
+ "enabled",
1004
+ "flushMs",
1005
+ "draining",
1006
+ "pendingBatches",
1007
+ "pendingRecords",
1008
+ "recordsFlushed",
1009
+ "recordsQueued"
1010
+ ],
1011
+ "properties": {
1012
+ "enabled": {
1013
+ "type": "boolean"
1014
+ },
1015
+ "flushMs": {
1016
+ "type": "number",
1017
+ "minimum": 0
1018
+ },
1019
+ "draining": {
1020
+ "type": "boolean"
1021
+ },
1022
+ "pendingBatches": {
1023
+ "type": "integer",
1024
+ "minimum": 0
1025
+ },
1026
+ "pendingRecords": {
1027
+ "type": "integer",
1028
+ "minimum": 0
1029
+ },
1030
+ "recordsFlushed": {
1031
+ "type": "integer",
1032
+ "minimum": 0
1033
+ },
1034
+ "recordsQueued": {
1035
+ "type": "integer",
1036
+ "minimum": 0
1037
+ },
1038
+ "lastError": {
1039
+ "type": "string"
1040
+ },
1041
+ "lastFlushAt": {
1042
+ "type": "string",
1043
+ "format": "date-time"
1044
+ }
1045
+ }
1046
+ },
1047
+ "AlertState": {
1048
+ "type": "object",
1049
+ "additionalProperties": false,
1050
+ "required": [
1051
+ "running",
1052
+ "runs",
1053
+ "sent",
1054
+ "suppressed",
1055
+ "lastTriggerAtByRule"
1056
+ ],
1057
+ "properties": {
1058
+ "running": {
1059
+ "type": "boolean"
1060
+ },
1061
+ "runs": {
1062
+ "type": "integer",
1063
+ "minimum": 0
1064
+ },
1065
+ "sent": {
1066
+ "type": "integer",
1067
+ "minimum": 0
1068
+ },
1069
+ "suppressed": {
1070
+ "type": "integer",
1071
+ "minimum": 0
1072
+ },
1073
+ "lastRunAt": {
1074
+ "type": "string",
1075
+ "format": "date-time"
1076
+ },
1077
+ "lastSuccessAt": {
1078
+ "type": "string",
1079
+ "format": "date-time"
1080
+ },
1081
+ "lastDurationMs": {
1082
+ "type": "number",
1083
+ "minimum": 0
1084
+ },
1085
+ "lastError": {
1086
+ "type": "string"
1087
+ },
1088
+ "lastTriggerAtByRule": {
1089
+ "type": "object",
1090
+ "additionalProperties": {
1091
+ "type": "string",
1092
+ "format": "date-time"
1093
+ }
1094
+ }
1095
+ }
1096
+ },
1097
+ "AlertPolicy": {
1098
+ "type": "object",
1099
+ "additionalProperties": false,
1100
+ "required": [
1101
+ "enabled",
1102
+ "intervalMs",
1103
+ "windowMinutes",
1104
+ "errorThreshold",
1105
+ "noLogsThresholdMinutes",
1106
+ "cooldownMs",
1107
+ "webhookTimeoutMs",
1108
+ "webhookRetryAttempts",
1109
+ "webhookBackoffMs"
1110
+ ],
1111
+ "properties": {
1112
+ "enabled": {
1113
+ "type": "boolean"
1114
+ },
1115
+ "webhookUrl": {
1116
+ "type": "string",
1117
+ "description": "`[configured]` when configured, otherwise omitted."
1118
+ },
1119
+ "intervalMs": {
1120
+ "type": "number",
1121
+ "minimum": 0
1122
+ },
1123
+ "windowMinutes": {
1124
+ "type": "number",
1125
+ "minimum": 0
1126
+ },
1127
+ "errorThreshold": {
1128
+ "type": "number",
1129
+ "minimum": 0
1130
+ },
1131
+ "noLogsThresholdMinutes": {
1132
+ "type": "number",
1133
+ "minimum": 0
1134
+ },
1135
+ "cooldownMs": {
1136
+ "type": "number",
1137
+ "minimum": 0
1138
+ },
1139
+ "webhookTimeoutMs": {
1140
+ "type": "number",
1141
+ "minimum": 0
1142
+ },
1143
+ "webhookRetryAttempts": {
1144
+ "type": "integer",
1145
+ "minimum": 1
1146
+ },
1147
+ "webhookBackoffMs": {
1148
+ "type": "number",
1149
+ "minimum": 0
1150
+ }
1151
+ }
1152
+ },
1153
+ "AuthStatus": {
1154
+ "type": "object",
1155
+ "additionalProperties": false,
1156
+ "required": [
1157
+ "apiTokenEnabled",
1158
+ "basicEnabled"
1159
+ ],
1160
+ "properties": {
1161
+ "apiTokenEnabled": {
1162
+ "type": "boolean"
1163
+ },
1164
+ "basicEnabled": {
1165
+ "type": "boolean"
1166
+ }
1167
+ }
1168
+ },
1169
+ "RetentionDays": {
1170
+ "type": "object",
1171
+ "additionalProperties": false,
1172
+ "required": [
1173
+ "db",
1174
+ "dbAudit",
1175
+ "logs",
1176
+ "logsAudit"
1177
+ ],
1178
+ "properties": {
1179
+ "db": {
1180
+ "type": "number",
1181
+ "minimum": 0
1182
+ },
1183
+ "dbAudit": {
1184
+ "type": "number",
1185
+ "minimum": 0
1186
+ },
1187
+ "logs": {
1188
+ "type": "number",
1189
+ "minimum": 0
1190
+ },
1191
+ "logsAudit": {
1192
+ "type": "number",
1193
+ "minimum": 0
1194
+ }
1195
+ }
1196
+ },
1197
+ "Backup": {
1198
+ "type": "object",
1199
+ "additionalProperties": false,
1200
+ "properties": {
1201
+ "auditDirectory": {
1202
+ "type": "string"
1203
+ }
1204
+ }
1205
+ },
1206
+ "Storage": {
1207
+ "type": "object",
1208
+ "additionalProperties": false,
1209
+ "required": [
1210
+ "dbApproximateSizeBytes",
1211
+ "dbDirectoryFreeBytes",
1212
+ "logsDirectoryFreeBytes",
1213
+ "minFreeBytes"
1214
+ ],
1215
+ "properties": {
1216
+ "dbApproximateSizeBytes": {
1217
+ "type": "number",
1218
+ "minimum": 0
1219
+ },
1220
+ "dbDirectoryFreeBytes": {
1221
+ "type": "number",
1222
+ "minimum": 0
1223
+ },
1224
+ "logsDirectoryFreeBytes": {
1225
+ "type": "number",
1226
+ "minimum": 0
1227
+ },
1228
+ "minFreeBytes": {
1229
+ "type": "number",
1230
+ "minimum": 0
1231
+ }
1232
+ }
1233
+ },
1234
+ "MaintenanceState": {
1235
+ "type": "object",
1236
+ "additionalProperties": false,
1237
+ "required": [
1238
+ "running",
1239
+ "runs",
1240
+ "filesDeletedLastRun",
1241
+ "filesDeletedTotal",
1242
+ "normalFilesDeletedLastRun",
1243
+ "normalFilesDeletedTotal",
1244
+ "auditFilesDeletedLastRun",
1245
+ "auditFilesDeletedTotal",
1246
+ "entriesDeletedLastRun",
1247
+ "entriesDeletedTotal",
1248
+ "normalEntriesDeletedLastRun",
1249
+ "normalEntriesDeletedTotal",
1250
+ "auditEntriesDeletedLastRun",
1251
+ "auditEntriesDeletedTotal",
1252
+ "fieldsDeletedLastRun",
1253
+ "fieldsDeletedTotal",
1254
+ "vacuumRuns"
1255
+ ],
1256
+ "properties": {
1257
+ "running": {
1258
+ "type": "boolean"
1259
+ },
1260
+ "runs": {
1261
+ "type": "integer",
1262
+ "minimum": 0
1263
+ },
1264
+ "lastRunAt": {
1265
+ "type": "string",
1266
+ "format": "date-time"
1267
+ },
1268
+ "lastSuccessAt": {
1269
+ "type": "string",
1270
+ "format": "date-time"
1271
+ },
1272
+ "lastDurationMs": {
1273
+ "type": "number",
1274
+ "minimum": 0
1275
+ },
1276
+ "lastError": {
1277
+ "type": "string"
1278
+ },
1279
+ "filesDeletedLastRun": {
1280
+ "type": "integer",
1281
+ "minimum": 0
1282
+ },
1283
+ "filesDeletedTotal": {
1284
+ "type": "integer",
1285
+ "minimum": 0
1286
+ },
1287
+ "normalFilesDeletedLastRun": {
1288
+ "type": "integer",
1289
+ "minimum": 0
1290
+ },
1291
+ "normalFilesDeletedTotal": {
1292
+ "type": "integer",
1293
+ "minimum": 0
1294
+ },
1295
+ "auditFilesDeletedLastRun": {
1296
+ "type": "integer",
1297
+ "minimum": 0
1298
+ },
1299
+ "auditFilesDeletedTotal": {
1300
+ "type": "integer",
1301
+ "minimum": 0
1302
+ },
1303
+ "entriesDeletedLastRun": {
1304
+ "type": "integer",
1305
+ "minimum": 0
1306
+ },
1307
+ "entriesDeletedTotal": {
1308
+ "type": "integer",
1309
+ "minimum": 0
1310
+ },
1311
+ "normalEntriesDeletedLastRun": {
1312
+ "type": "integer",
1313
+ "minimum": 0
1314
+ },
1315
+ "normalEntriesDeletedTotal": {
1316
+ "type": "integer",
1317
+ "minimum": 0
1318
+ },
1319
+ "auditEntriesDeletedLastRun": {
1320
+ "type": "integer",
1321
+ "minimum": 0
1322
+ },
1323
+ "auditEntriesDeletedTotal": {
1324
+ "type": "integer",
1325
+ "minimum": 0
1326
+ },
1327
+ "fieldsDeletedLastRun": {
1328
+ "type": "integer",
1329
+ "minimum": 0
1330
+ },
1331
+ "fieldsDeletedTotal": {
1332
+ "type": "integer",
1333
+ "minimum": 0
1334
+ },
1335
+ "vacuumRuns": {
1336
+ "type": "integer",
1337
+ "minimum": 0
1338
+ }
1339
+ }
1340
+ },
1341
+ "IngestEndpointStatus": {
1342
+ "type": "object",
1343
+ "additionalProperties": false,
1344
+ "required": [
1345
+ "enabled",
1346
+ "maxBodyBytes",
1347
+ "producerCount",
1348
+ "queue"
1349
+ ],
1350
+ "properties": {
1351
+ "enabled": {
1352
+ "type": "boolean"
1353
+ },
1354
+ "maxBodyBytes": {
1355
+ "type": "number",
1356
+ "minimum": 0
1357
+ },
1358
+ "producerCount": {
1359
+ "type": "integer",
1360
+ "minimum": 0
1361
+ },
1362
+ "queue": {
1363
+ "$ref": "#/components/schemas/IngestQueueHealth"
1364
+ }
1365
+ }
1366
+ },
1367
+ "HealthResponse": {
1368
+ "type": "object",
1369
+ "additionalProperties": false,
1370
+ "required": [
1371
+ "ok",
1372
+ "service",
1373
+ "uptimeSec",
1374
+ "ingest",
1375
+ "auth",
1376
+ "ingestPolicy",
1377
+ "ingestEndpoint",
1378
+ "alerting",
1379
+ "alertPolicy",
1380
+ "maintenance",
1381
+ "retentionDays",
1382
+ "backup",
1383
+ "storage"
1384
+ ],
1385
+ "properties": {
1386
+ "ok": {
1387
+ "type": "boolean"
1388
+ },
1389
+ "service": {
1390
+ "type": "string",
1391
+ "enum": [
1392
+ "mikroscope"
1393
+ ]
1394
+ },
1395
+ "uptimeSec": {
1396
+ "type": "number",
1397
+ "minimum": 0
1398
+ },
1399
+ "ingest": {
1400
+ "$ref": "#/components/schemas/IngestState"
1401
+ },
1402
+ "auth": {
1403
+ "$ref": "#/components/schemas/AuthStatus"
1404
+ },
1405
+ "ingestPolicy": {
1406
+ "$ref": "#/components/schemas/IngestPolicy"
1407
+ },
1408
+ "ingestEndpoint": {
1409
+ "$ref": "#/components/schemas/IngestEndpointStatus"
1410
+ },
1411
+ "alerting": {
1412
+ "$ref": "#/components/schemas/AlertState"
1413
+ },
1414
+ "alertPolicy": {
1415
+ "$ref": "#/components/schemas/AlertPolicy"
1416
+ },
1417
+ "maintenance": {
1418
+ "$ref": "#/components/schemas/MaintenanceState"
1419
+ },
1420
+ "retentionDays": {
1421
+ "$ref": "#/components/schemas/RetentionDays"
1422
+ },
1423
+ "backup": {
1424
+ "$ref": "#/components/schemas/Backup"
1425
+ },
1426
+ "storage": {
1427
+ "$ref": "#/components/schemas/Storage"
1428
+ }
1429
+ }
1430
+ }
1431
+ }
1432
+ }
1433
+ }