sourcebot/docs/docs/configuration/structured-logging.mdx
Michael Sukkarieh 5438298d61
feat(audit-logging): Adds audit logging support (#355)
* add audit factory skeleton

* add additional audit events

* add more audit logs

* delete account join request when redeeming an invite

* add audit event for account request removed

* wip api to fetch audits

* add check for audit with public access and entitlement

* fix issues with merge

* add docs for audit logs

* add proper audit log for audit fetch and proper handling of api key hash in audit

* format nit

* feedback
2025-06-18 10:50:36 -07:00

40 lines
No EOL
1.3 KiB
Text

---
title: Structured Logging
sidebarTitle: Structured logging
---
By default, Sourcebot will output logs to the console in a human readable format. If you'd like Sourcebot to output structured JSON logs, set the following env vars:
- `SOURCEBOT_STRUCTURED_LOGGING_ENABLED` (default: `false`): Controls whether logs are in a structured JSON format
- `SOURCEBOT_STRUCTURED_LOGGING_FILE`: If structured logging is enabled and this env var is set, structured logs will be written to this file (ex. `/data/sourcebot.log`)
### Structured log schema
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "SourcebotLog",
"properties": {
"level": {
"type": "string",
"description": "The log level (error, warning, info, debug)"
},
"service": {
"type": "string",
"description": "The Sourcebot component that generated the log"
},
"message": {
"type": "string",
"description": "The log message"
},
"status": {
"type": "string",
"description": "The same value as the level field added for datadog support"
},
"timestamp": {
"type": "string",
"description": "The timestamp of the log in ISO 8061 format"
}
}
}
```