TanmoySG / wunderDB

A micro JSON-based Data Store inspired by MongoDB.
http://wdb.tanmoysg.com/api/
Apache License 2.0
12 stars 0 forks source link

[Design] Transaction Logs `TxLogs` #75

Closed TanmoySG closed 1 year ago

TanmoySG commented 1 year ago

Transaction Logs storage TxLogs for wunderDb with detailed actions performed with complete payload and other details of a request made to wunderDb

TanmoySG commented 1 year ago

TxLogs Example and JSON Schema

Example ```json { "entity_type": "db/collection/user/role", "action": "privilege-used", "entity_path": { "db": "db", "collection": "collection", "user": "user", "role": "role" }, "status": "success/failure", "timestamp": "", "actor": "", "transaction_http_details": { "url_endpoint": "path without base url", "request": { "method": "POST/GET/etc", "payload": {} }, "response": { "http_status": "", "response_body": {} } } } ```
JSON Schema ```jsonl { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Generated schema for Root", "type": "object", "properties": { "entity_type": { "type": "string" }, "action": { "type": "string" }, "entity_path": { "type": "object", "properties": { "db": { "type": "string" }, "collection": { "type": "string" }, "user": { "type": "string" }, "role": { "type": "string" } }, "required": [ "db", "collection", "user", "role" ] }, "status": { "type": "string" }, "timestamp": { "type": "string" }, "actor": { "type": "string" }, "transaction_http_details": { "type": "object", "properties": { "url_endpoint": { "type": "string" }, "request": { "type": "object", "properties": { "method": { "type": "string" }, "payload": { "type": "object", "properties": {}, "required": [] } }, "required": [ "method", "payload" ] }, "response": { "type": "object", "properties": { "http_status": { "type": "string" }, "response_body": { "type": "object", "properties": {}, "required": [] } }, "required": [ "http_status", "response_body" ] } }, "required": [ "url_endpoint", "request", "response" ] } }, "required": [ "entity_type", "action", "entity_path", "status", "timestamp", "actor", "transaction_http_details" ] } ```
TanmoySG commented 1 year ago
JSON Schema

```json { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Generated schema for Root", "type": "object", "properties": { "entity_type": { "type": "string" }, "action": { "type": "string" }, "entity_path": { "type": "object", "properties": { "db": { "type": "string" }, "collection": { "type": "string" }, "user": { "type": "string" }, "role": { "type": "string" } }, "required": [ "db", "collection", "user", "role" ] }, "status": { "type": "string" }, "timestamp": { "type": "string" }, "actor": { "type": "string" }, "transaction_http_details": { "type": "object", "properties": { "url_endpoint": { "type": "string" }, "method": { "type": "string" }, "request": { "type": "object", "properties": { "user-agent": { "type": "object", "properties": {}, "required": [] }, "is_authenticated": { "type": "string" }, "payload": { "type": "object", "properties": {}, "required": [] } }, "required": [ "user-agent", "is_authenticated", "payload" ] }, "response": { "type": "object", "properties": { "http_status": { "type": "string" }, "response_body": { "type": "object", "properties": {}, "required": [] } }, "required": [ "http_status", "response_body" ] } }, "required": [ "url_endpoint", "method", "request", "response" ] } }, "required": [ "entity_type", "action", "entity_path", "status", "timestamp", "actor", "transaction_http_details" ] } ```

TanmoySG commented 1 year ago
Example

```json { "entity_type": "db/collection/user/role", "action": "privilege-used", "entity_path": { "db": "db", "collection": "collection", "user": "user", "role": "role" }, "status": "success/failure", "timestamp": "", "actor": "", "transaction_http_details": { "url_endpoint": "path without base url", "method": "POST/GET/etc", "request": { "user-agent": {}, "is_authenticated": "true/false", "payload": {} }, "response": { "http_status": "", "response_body": {} } } } ```

TanmoySG commented 1 year ago

Init

                "user": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                }