1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.logging.v2; 18 19import "google/api/field_behavior.proto"; 20import "google/api/monitored_resource.proto"; 21import "google/api/resource.proto"; 22import "google/logging/type/http_request.proto"; 23import "google/logging/type/log_severity.proto"; 24import "google/protobuf/any.proto"; 25import "google/protobuf/struct.proto"; 26import "google/protobuf/timestamp.proto"; 27 28option cc_enable_arenas = true; 29option csharp_namespace = "Google.Cloud.Logging.V2"; 30option go_package = "cloud.google.com/go/logging/apiv2/loggingpb;loggingpb"; 31option java_multiple_files = true; 32option java_outer_classname = "LogEntryProto"; 33option java_package = "com.google.logging.v2"; 34option php_namespace = "Google\\Cloud\\Logging\\V2"; 35option ruby_package = "Google::Cloud::Logging::V2"; 36 37// An individual entry in a log. 38message LogEntry { 39 option (google.api.resource) = { 40 type: "logging.googleapis.com/Log" 41 pattern: "projects/{project}/logs/{log}" 42 pattern: "organizations/{organization}/logs/{log}" 43 pattern: "folders/{folder}/logs/{log}" 44 pattern: "billingAccounts/{billing_account}/logs/{log}" 45 name_field: "log_name" 46 }; 47 48 // Required. The resource name of the log to which this log entry belongs: 49 // 50 // "projects/[PROJECT_ID]/logs/[LOG_ID]" 51 // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" 52 // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" 53 // "folders/[FOLDER_ID]/logs/[LOG_ID]" 54 // 55 // A project number may be used in place of PROJECT_ID. The project number is 56 // translated to its corresponding PROJECT_ID internally and the `log_name` 57 // field will contain PROJECT_ID in queries and exports. 58 // 59 // `[LOG_ID]` must be URL-encoded within `log_name`. Example: 60 // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. 61 // 62 // `[LOG_ID]` must be less than 512 characters long and can only include the 63 // following characters: upper and lower case alphanumeric characters, 64 // forward-slash, underscore, hyphen, and period. 65 // 66 // For backward compatibility, if `log_name` begins with a forward-slash, such 67 // as `/projects/...`, then the log entry is ingested as usual, but the 68 // forward-slash is removed. Listing the log entry will not show the leading 69 // slash and filtering for a log name with a leading slash will never return 70 // any results. 71 string log_name = 12 [(google.api.field_behavior) = REQUIRED]; 72 73 // Required. The monitored resource that produced this log entry. 74 // 75 // Example: a log entry that reports a database error would be associated with 76 // the monitored resource designating the particular database that reported 77 // the error. 78 google.api.MonitoredResource resource = 8 79 [(google.api.field_behavior) = REQUIRED]; 80 81 // The log entry payload, which can be one of multiple types. 82 oneof payload { 83 // The log entry payload, represented as a protocol buffer. Some Google 84 // Cloud Platform services use this field for their log entry payloads. 85 // 86 // The following protocol buffer types are supported; user-defined types 87 // are not supported: 88 // 89 // "type.googleapis.com/google.cloud.audit.AuditLog" 90 // "type.googleapis.com/google.appengine.logging.v1.RequestLog" 91 google.protobuf.Any proto_payload = 2; 92 93 // The log entry payload, represented as a Unicode string (UTF-8). 94 string text_payload = 3; 95 96 // The log entry payload, represented as a structure that is 97 // expressed as a JSON object. 98 google.protobuf.Struct json_payload = 6; 99 } 100 101 // Optional. The time the event described by the log entry occurred. This time 102 // is used to compute the log entry's age and to enforce the logs retention 103 // period. If this field is omitted in a new log entry, then Logging assigns 104 // it the current time. Timestamps have nanosecond accuracy, but trailing 105 // zeros in the fractional seconds might be omitted when the timestamp is 106 // displayed. 107 // 108 // Incoming log entries must have timestamps that don't exceed the 109 // [logs retention 110 // period](https://cloud.google.com/logging/quotas#logs_retention_periods) in 111 // the past, and that don't exceed 24 hours in the future. Log entries outside 112 // those time boundaries aren't ingested by Logging. 113 google.protobuf.Timestamp timestamp = 9 114 [(google.api.field_behavior) = OPTIONAL]; 115 116 // Output only. The time the log entry was received by Logging. 117 google.protobuf.Timestamp receive_timestamp = 24 118 [(google.api.field_behavior) = OUTPUT_ONLY]; 119 120 // Optional. The severity of the log entry. The default value is 121 // `LogSeverity.DEFAULT`. 122 google.logging.type.LogSeverity severity = 10 123 [(google.api.field_behavior) = OPTIONAL]; 124 125 // Optional. A unique identifier for the log entry. If you provide a value, 126 // then Logging considers other log entries in the same project, with the same 127 // `timestamp`, and with the same `insert_id` to be duplicates which are 128 // removed in a single query result. However, there are no guarantees of 129 // de-duplication in the export of logs. 130 // 131 // If the `insert_id` is omitted when writing a log entry, the Logging API 132 // assigns its own unique identifier in this field. 133 // 134 // In queries, the `insert_id` is also used to order log entries that have 135 // the same `log_name` and `timestamp` values. 136 string insert_id = 4 [(google.api.field_behavior) = OPTIONAL]; 137 138 // Optional. Information about the HTTP request associated with this log 139 // entry, if applicable. 140 google.logging.type.HttpRequest http_request = 7 141 [(google.api.field_behavior) = OPTIONAL]; 142 143 // Optional. A map of key, value pairs that provides additional information 144 // about the log entry. The labels can be user-defined or system-defined. 145 // 146 // User-defined labels are arbitrary key, value pairs that you can use to 147 // classify logs. 148 // 149 // System-defined labels are defined by GCP services for platform logs. 150 // They have two components - a service namespace component and the 151 // attribute name. For example: `compute.googleapis.com/resource_name`. 152 // 153 // Cloud Logging truncates label keys that exceed 512 B and label 154 // values that exceed 64 KB upon their associated log entry being 155 // written. The truncation is indicated by an ellipsis at the 156 // end of the character string. 157 map<string, string> labels = 11 [(google.api.field_behavior) = OPTIONAL]; 158 159 // Optional. Information about an operation associated with the log entry, if 160 // applicable. 161 LogEntryOperation operation = 15 [(google.api.field_behavior) = OPTIONAL]; 162 163 // Optional. The REST resource name of the trace being written to 164 // [Cloud Trace](https://cloud.google.com/trace) in 165 // association with this log entry. For example, if your trace data is stored 166 // in the Cloud project "my-trace-project" and if the service that is creating 167 // the log entry receives a trace header that includes the trace ID "12345", 168 // then the service should use "projects/my-tracing-project/traces/12345". 169 // 170 // The `trace` field provides the link between logs and traces. By using 171 // this field, you can navigate from a log entry to a trace. 172 string trace = 22 [(google.api.field_behavior) = OPTIONAL]; 173 174 // Optional. The ID of the [Cloud Trace](https://cloud.google.com/trace) span 175 // associated with the current operation in which the log is being written. 176 // For example, if a span has the REST resource name of 177 // "projects/some-project/traces/some-trace/spans/some-span-id", then the 178 // `span_id` field is "some-span-id". 179 // 180 // A 181 // [Span](https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span) 182 // represents a single operation within a trace. Whereas a trace may involve 183 // multiple different microservices running on multiple different machines, 184 // a span generally corresponds to a single logical operation being performed 185 // in a single instance of a microservice on one specific machine. Spans 186 // are the nodes within the tree that is a trace. 187 // 188 // Applications that are [instrumented for 189 // tracing](https://cloud.google.com/trace/docs/setup) will generally assign a 190 // new, unique span ID on each incoming request. It is also common to create 191 // and record additional spans corresponding to internal processing elements 192 // as well as issuing requests to dependencies. 193 // 194 // The span ID is expected to be a 16-character, hexadecimal encoding of an 195 // 8-byte array and should not be zero. It should be unique within the trace 196 // and should, ideally, be generated in a manner that is uniformly random. 197 // 198 // Example values: 199 // 200 // - `000000000000004a` 201 // - `7a2190356c3fc94b` 202 // - `0000f00300090021` 203 // - `d39223e101960076` 204 string span_id = 27 [(google.api.field_behavior) = OPTIONAL]; 205 206 // Optional. The sampling decision of the trace associated with the log entry. 207 // 208 // True means that the trace resource name in the `trace` field was sampled 209 // for storage in a trace backend. False means that the trace was not sampled 210 // for storage when this log entry was written, or the sampling decision was 211 // unknown at the time. A non-sampled `trace` value is still useful as a 212 // request correlation identifier. The default is False. 213 bool trace_sampled = 30 [(google.api.field_behavior) = OPTIONAL]; 214 215 // Optional. Source code location information associated with the log entry, 216 // if any. 217 LogEntrySourceLocation source_location = 23 218 [(google.api.field_behavior) = OPTIONAL]; 219 220 // Optional. Information indicating this LogEntry is part of a sequence of 221 // multiple log entries split from a single LogEntry. 222 LogSplit split = 35 [(google.api.field_behavior) = OPTIONAL]; 223} 224 225// Additional information about a potentially long-running operation with which 226// a log entry is associated. 227message LogEntryOperation { 228 // Optional. An arbitrary operation identifier. Log entries with the same 229 // identifier are assumed to be part of the same operation. 230 string id = 1 [(google.api.field_behavior) = OPTIONAL]; 231 232 // Optional. An arbitrary producer identifier. The combination of `id` and 233 // `producer` must be globally unique. Examples for `producer`: 234 // `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`. 235 string producer = 2 [(google.api.field_behavior) = OPTIONAL]; 236 237 // Optional. Set this to True if this is the first log entry in the operation. 238 bool first = 3 [(google.api.field_behavior) = OPTIONAL]; 239 240 // Optional. Set this to True if this is the last log entry in the operation. 241 bool last = 4 [(google.api.field_behavior) = OPTIONAL]; 242} 243 244// Additional information about the source code location that produced the log 245// entry. 246message LogEntrySourceLocation { 247 // Optional. Source file name. Depending on the runtime environment, this 248 // might be a simple name or a fully-qualified name. 249 string file = 1 [(google.api.field_behavior) = OPTIONAL]; 250 251 // Optional. Line within the source file. 1-based; 0 indicates no line number 252 // available. 253 int64 line = 2 [(google.api.field_behavior) = OPTIONAL]; 254 255 // Optional. Human-readable name of the function or method being invoked, with 256 // optional context such as the class or package name. This information may be 257 // used in contexts such as the logs viewer, where a file and line number are 258 // less meaningful. The format can vary by language. For example: 259 // `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function` 260 // (Python). 261 string function = 3 [(google.api.field_behavior) = OPTIONAL]; 262} 263 264// Additional information used to correlate multiple log entries. Used when a 265// single LogEntry would exceed the Google Cloud Logging size limit and is 266// split across multiple log entries. 267message LogSplit { 268 // A globally unique identifier for all log entries in a sequence of split log 269 // entries. All log entries with the same |LogSplit.uid| are assumed to be 270 // part of the same sequence of split log entries. 271 string uid = 1; 272 273 // The index of this LogEntry in the sequence of split log entries. Log 274 // entries are given |index| values 0, 1, ..., n-1 for a sequence of n log 275 // entries. 276 int32 index = 2; 277 278 // The total number of log entries that the original LogEntry was split into. 279 int32 total_splits = 3; 280} 281