The auditlogs client methods are currently in ALPHA. The API may change without notice. A one-time warning is emitted on first use.
Audit logs record authenticated user actions across the account. The caller must be an account admin and the account must have audit logging enabled. Entries are ordered newest first and can be filtered by time window, user, or operation type.
List Audit Logs
List returns a paginated list of audit log entries. StartTime defaults to 30 days before EndTime when zero; EndTime defaults to the current time when zero. UserID (base64-encoded resource ID) and OperationType (one of AuditLogOperationTypeQUERY, AuditLogOperationTypeMUTATION, AuditLogOperationTypeSUBSCRIPTION) apply exact-match filters when set. Defaults to a page size of 50 (server max is 100).
Signature:
func (c *Client) List(ctx context.Context, req ListRequest) (*AuditLogList, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"time"
"github.com/Arize-ai/client-go-v2/arize"
"github.com/Arize-ai/client-go-v2/arize/auditlogs"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
resp, err := client.AuditLogs.List(context.Background(), auditlogs.ListRequest{
StartTime: time.Now().Add(-7 * 24 * time.Hour),
EndTime: time.Now(),
OperationType: auditlogs.AuditLogOperationTypeMUTATION,
Limit: 50,
})
if err != nil {
var forbidden *arize.ForbiddenError
if errors.As(err, &forbidden) {
log.Fatalf("audit log access requires account admin: %v", forbidden)
}
log.Fatal(err)
}
for _, entry := range resp.Logs {
fmt.Printf("%s: user=%s operation=%s\n",
entry.Id,
entry.UserId,
entry.OperationType,
)
}
}