Skip to main content
POST
/
v1
/
projects
/
{project}
/
auditLogs:search
cURL
curl --request POST \
  --url https://api.example.com/v1/projects/{project}/auditLogs:search \
  --header 'Content-Type: application/json' \
  --data '
{
  "parent": "<string>",
  "filter": "<string>",
  "orderBy": "<string>",
  "pageSize": 123,
  "pageToken": "<string>"
}
'
{
  "auditLogs": [
    {
      "name": "<string>",
      "createTime": "2023-11-07T05:31:56Z",
      "user": "<string>",
      "method": "<string>",
      "severity": "SEVERITY_UNSPECIFIED",
      "resource": "<string>",
      "request": "<string>",
      "response": "<string>",
      "status": {
        "code": 123,
        "message": "<string>",
        "details": [
          {
            "@type": "<string>"
          }
        ]
      },
      "latency": "<string>",
      "serviceData": {
        "@type": "<string>"
      },
      "requestMetadata": {
        "callerIp": "<string>",
        "callerSuppliedUserAgent": "<string>"
      }
    }
  ],
  "nextPageToken": "<string>"
}

Path Parameters

project
string
required

The project id.

Body

application/json

Request message for searching audit logs.

parent
string
required
filter
string

The filter of the log. It should be a valid CEL expression. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec

Supported filter:

  • method: the API name, can be found in the docs, should start with "/bytebase.v1." prefix. For example "/bytebase.v1.UserService/CreateUser". Support "==" operator.
  • severity: support "==" operator, check Severity enum in AuditLog message for values.
  • user: the actor, should in "users/{email}" format, support "==" operator.
  • create_time: support ">=" and "<=" operator.

For example:

  • filter = "method == '/bytebase.v1.SQLService/Query'"
  • filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR'"
  • filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && user == 'users/[email protected]'"
  • filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && create_time <= '2021-01-01T00:00:00Z' && create_time >= '2020-01-01T00:00:00Z'"
orderBy
string

The order by of the log. Only support order by create_time. For example:

  • order_by = "create_time asc"
  • order_by = "create_time desc"
pageSize
integer<int32>

The maximum number of logs to return. The service may return fewer than this value. If unspecified, at most 10 log entries will be returned. The maximum value is 5000; values above 5000 will be coerced to 5000.

pageToken
string

A page token, received from a previous SearchLogs call. Provide this to retrieve the subsequent page.

Response

OK

Response message for searching audit logs.

auditLogs
object[]
nextPageToken
string

A token to retrieve next page of log entities. Pass this value in the page_token field in the subsequent call to retrieve the next page of log entities.