Audit logs
- Ghi lại các hoạt động quản trị:
- Tạo/xóa instance
- Thay đổi cấu hình
- Restart instances
- Thay đổi users/passwords
- Path:
cloudsql_googleapis_com/mysql_audit
hoặc postgres_audit
resource.type="cloudsql_database"
protoPayload.methodName="cloudsql.instances.update"
Error logs:
- Ghi lại các lỗi hệ thống:
- Database crashes
- Connection issues
- Memory/disk errors
- Path:
cloudsql_googleapis_com/mysql_error
hoặc postgres_error
- Query mẫu:
resource.type="cloudsql_database"
severity=ERROR
Query logs (Slow query):
- Ghi lại các query chậm
- Cần bật tính năng này trong instance
- Path:
cloudsql_googleapis_com/mysql_slowquery
- Query mẫu:
resource.type="cloudsql_database"
jsonPayload.userHost="xyz"
jsonPayload.queryTime > 10
Lưu ý:
- Logs được lưu trữ 30 ngày mặc định
- Có thể export logs sang BigQuery/Cloud Storage
- Cần IAM permission để xem logs