Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetAuditLogs API #35

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
107 changes: 107 additions & 0 deletions temporal/api/cloud/auditlog/v1/message.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
syntax = "proto3";

package temporal.api.cloud.auditlog.v1;

option go_package = "go.temporal.io/api/cloud/auditlog/v1;auditlog";
option java_package = "io.temporal.api.cloud.auditlog.v1";
option java_multiple_files = true;
option java_outer_classname = "MessageProto";
option ruby_package = "Temporalio::Api::Cloud::AuditLog::V1";
option csharp_namespace = "Temporalio.Api.Cloud.AuditLog.V1";

import "google/protobuf/timestamp.proto";

// LogRecord represents an audit log entry from Temporal, structured for easy parsing and analysis.
message LogRecord {
cretz marked this conversation as resolved.
Show resolved Hide resolved
shivam-ajmera marked this conversation as resolved.
Show resolved Hide resolved
// Time when the log was emitted from the source
google.protobuf.Timestamp emit_time = 1;

// Level of the log, i.e. info, warn, error etc
LogLevel level = 2;

// Operator email address - optional
string user_email = 3;

// Operator IP address or server name
shivam-ajmera marked this conversation as resolved.
Show resolved Hide resolved
string caller_ip_address = 4;

// Operation performed
string operation = 5;

// Detailed information about the operation.
OperationDetail details = 6;
shivam-ajmera marked this conversation as resolved.
Show resolved Hide resolved

// Operation status from API call
string status = 7;

// Admin or System
LogCategory category = 8;

// Specifies the version of the log entry to distinguish between different systems on the server side.
int32 version = 9;

// Unique ID for the log record.
string log_id = 10;
shivam-ajmera marked this conversation as resolved.
Show resolved Hide resolved
}

// OperationDetails includes potential more detailed operation logs extracted from the different fields in the
// Temporal API logs or third party logs, e.g. auth0
message OperationDetail {
shivam-ajmera marked this conversation as resolved.
Show resolved Hide resolved
// The namespace the operation was performed on - optional
string namespace = 1;

// The email addresses of the users on whom the operation was performed - optional
repeated string target_users = 2;

// Names of any roles/accesses assigned to identities that were processed in this request - optional
repeated string roles = 3;
shivam-ajmera marked this conversation as resolved.
Show resolved Hide resolved

// Fingerprints if client ca is included - optional
repeated string client_ca_fingerprints = 4;

// Details of a search attribute update - optional
SearchAttributeUpdate search_attribute_update = 5;

// Additional relevant message - optional
string additional_message = 6;

// Namespace's region - optional
string region = 7;

// If account features were updated i.e. external metrics, audit logging sink etc. - optional
repeated string account_features = 8;

// Third party log details eg: auth0 - optional
ThirdPartyLogDetail third_party_details = 9;
}

message SearchAttributeUpdate {
string existing_attribute = 1;

string new_attribute = 2;
}

message ThirdPartyLogDetail {
string id = 1;

// the third party source, e.g. auth0
string source = 2;

// the raw log message from the third party app, e.g. the whole auth0 event log
string raw_message = 3;
}

enum LogCategory {
LOG_CATEGORY_UNSPECIFIED = 0;
LOG_CATEGORY_ADMIN = 1;
LOG_CATEGORY_SYSTEM = 2;
}

enum LogLevel {
LOG_LEVEL_UNSPECIFIED = 0;
LOG_LEVEL_INFO = 1;
LOG_LEVEL_DEBUG = 2;
shivam-ajmera marked this conversation as resolved.
Show resolved Hide resolved
LOG_LEVEL_WARN = 3;
LOG_LEVEL_ERROR = 4;
LOG_LEVEL_FATAL = 5;
}
22 changes: 22 additions & 0 deletions temporal/api/cloud/cloudservice/v1/request_response.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ option java_outer_classname = "RequestResponseProto";
option ruby_package = "Temporalio::Api::Cloud::CloudService::V1";
option csharp_namespace = "Temporalio.Api.Cloud.CloudService.V1";

import "google/protobuf/timestamp.proto";

import "temporal/api/cloud/auditlog/v1/message.proto";
import "temporal/api/cloud/operation/v1/message.proto";
import "temporal/api/cloud/identity/v1/message.proto";
import "temporal/api/cloud/namespace/v1/message.proto";
Expand Down Expand Up @@ -525,3 +528,22 @@ message DeleteServiceAccountResponse {
// The async operation.
temporal.api.cloud.operation.v1.AsyncOperation async_operation = 1;
}

message GetAuditLogsRequest {
shivam-ajmera marked this conversation as resolved.
Show resolved Hide resolved
// The requested size of the page to retrieve - optional.
// Cannot exceed 1000. Defaults to 100.
int32 page_size = 1;
// The page token if this is continuing from another response - optional.
string page_token = 2;
// Filter for UTC time >= (defaults to 30 days ago) - optional.
google.protobuf.Timestamp start_time_inclusive = 3;
// Filter for UTC time < (defaults to current time) - optional.
google.protobuf.Timestamp end_time_exclusive = 4;
}

message GetAuditLogsResponse {
// The list of audit logs ordered by inserted time, emit time, log_id
repeated temporal.api.cloud.auditlog.v1.LogRecord logs = 1;
// The next page's token.
string next_page_token = 2;
}
7 changes: 7 additions & 0 deletions temporal/api/cloud/cloudservice/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,11 @@ service CloudService {
delete: "/cloud/service-accounts/{service_account_id}",
};
}

// Get audit logs
rpc GetAuditLogs(GetAuditLogsRequest) returns (GetAuditLogsResponse) {
option (google.api.http) = {
get: "/cloud/audit-logs",
};
}
}
4 changes: 3 additions & 1 deletion temporal/api/cloud/identity/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ option csharp_namespace = "Temporalio.Api.Cloud.Identity.V1";
import "google/protobuf/timestamp.proto";

message AccountAccess {
// The role on the account, should be one of [admin, developer, read]
// The role on the account, should be one of [owner, admin, developer, financeadmin, read]
// owner - gives full access to the account, including users, namespaces, and billing
// admin - gives full access the account, including users and namespaces
// developer - gives access to create namespaces on the account
// financeadmin - gives read only access and write access for billing
// read - gives read only access to the account
string role = 1;
}
Expand Down
Loading