Skip to content

Commit b4f3b9d

Browse files
update audit log (#962)
* update audit log export * update * update
1 parent a2ae075 commit b4f3b9d

File tree

1 file changed

+73
-4
lines changed

1 file changed

+73
-4
lines changed

docs/security/audit-log.mdx

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,82 @@ You can also export the audit logs.
2828

2929
![filter-date](/content/docs/security/audit-log/filter-date.webp)
3030

31-
## Emit audit logs to stdout
31+
## Stream audit logs to external systems
3232

33-
Bytebase can emit audit logs to **stdout**, allowing seamless integration with log aggregation and SIEM systems such as Datadog, Splunk, Elastic, Loki, CloudWatch, and GCP Logging—without using the API.
33+
Bytebase can stream audit logs to **stdout** for collection by external logging and monitoring systems.
3434

35-
Go to **Settings** -> **General** -> **Audit Log Export**, and enable **Enable audit logging to stdout**.
35+
### Configuration
3636

37-
Once enabled, audit events will appear in the standard output stream of your Bytebase service.
37+
1. Navigate to **Settings****General****Audit Log Export**.
38+
2. Enable **Enable audit logging to stdout**.
39+
40+
Once enabled, audit events stream to the standard output of your Bytebase service.
41+
42+
### Output format
43+
44+
By default, audit logs are output as key-value pairs. To enable JSON format for easier parsing by log aggregators, start Bytebase with one of these flags:
45+
46+
- `--enable-json-logging` - Outputs all logs in JSON format (you still need to enable the audit log export in the settings)
47+
48+
**Docker example with JSON format:**
49+
```bash
50+
docker run --rm --init \
51+
--name bytebase \
52+
--publish 8080:8080 --pull always \
53+
--volume ~/.bytebase/data:/var/opt/bytebase \
54+
bytebase/bytebase:latest \
55+
--port 8080 --data /var/opt/bytebase --enable-json-logging
56+
```
57+
58+
<Note>
59+
While using the `--enable-json-logging` flag, you need to specify the port and data directory.
60+
</Note>
61+
62+
### Example output
63+
64+
**Default format (key-value pairs):**
65+
```
66+
time=2025-12-10T15:55:21.729Z level=INFO source=v1/audit.go:274
67+
msg=/bytebase.v1.ProjectService/SetIamPolicy log_type=audit
68+
parent=projects/project-sample method=/bytebase.v1.ProjectService/SetIamPolicy
69+
resource=projects/project-sample user=users/101 latency_ms=7
70+
client_ip=192.168.65.1:51907 user_agent="Mozilla/5.0..." severity=INFO
71+
```
72+
73+
**With JSON format enabled:**
74+
```json
75+
{
76+
"time": "2025-12-10T15:55:21.729Z",
77+
"level": "INFO",
78+
"source": "v1/audit.go:274",
79+
"msg": "/bytebase.v1.ProjectService/SetIamPolicy",
80+
"log_type": "audit",
81+
"parent": "projects/project-sample",
82+
"method": "/bytebase.v1.ProjectService/SetIamPolicy",
83+
"resource": "projects/project-sample",
84+
"user": "users/101",
85+
"latency_ms": 7,
86+
"client_ip": "192.168.65.1:51907",
87+
"user_agent": "Mozilla/5.0...",
88+
"severity": "INFO"
89+
}
90+
```
91+
92+
### Integration
93+
94+
When running Bytebase in Docker or Kubernetes, audit logs automatically appear in container logs and can be collected by your existing logging infrastructure:
95+
96+
- **Docker**: Access via `docker logs` or configure Docker logging drivers
97+
- **Kubernetes**: Collected by cluster logging systems (Fluentd, Fluent Bit)
98+
- **Cloud platforms**: Stream to CloudWatch (AWS), Cloud Logging (GCP), or Azure Monitor
99+
100+
### Supported systems
101+
102+
The stdout logs can be ingested by any log collection system, including:
103+
104+
- **SIEM platforms**: Splunk, Datadog, Elastic, Sumo Logic, Panther
105+
- **Log aggregators**: Fluentd, Logstash, Vector, Loki
106+
- **Cloud logging**: AWS CloudWatch, GCP Logging, Azure Monitor
38107

39108
## Retention
40109

0 commit comments

Comments
 (0)