feat(logging): add Kafka and Webhook audit targets

- Implemented `KafkaAuditTarget` to send audit entries to a Kafka topic.
- Implemented `WebhookAuditTarget` to send audit entries to a specified webhook URL.
- Updated `AuditLogger` to support multiple audit targets including Kafka and Webhook.
- Added examples and documentation for the new audit targets.
This commit is contained in:
houseme
2025-02-21 18:49:25 +08:00
parent 03589201fb
commit c04536b132
5 changed files with 137 additions and 1 deletions
+8
View File
@@ -9,6 +9,11 @@ version.workspace = true
[lints]
workspace = true
[features]
default = []
audit-kafka = ["dep:rdkafka", "dep:serde_json"]
audit-webhook = ["dep:reqwest"]
[dependencies]
opentelemetry = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio"] }
@@ -20,6 +25,9 @@ tracing = { workspace = true }
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["fmt", "env-filter", "tracing-log", "time", "local-time", "json"] }
tokio = { workspace = true, features = ["full"] }
rdkafka = { workspace = true, features = ["tokio"], optional = true }
reqwest = { workspace = true, features = ["json"], optional = true }
serde_json = { workspace = true, optional = true }