log_entry.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. // Copyright 2022 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. syntax = "proto3";
  15. package google.logging.v2;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/monitored_resource.proto";
  18. import "google/api/resource.proto";
  19. import "google/logging/type/http_request.proto";
  20. import "google/logging/type/log_severity.proto";
  21. import "google/protobuf/any.proto";
  22. import "google/protobuf/struct.proto";
  23. import "google/protobuf/timestamp.proto";
  24. option cc_enable_arenas = true;
  25. option csharp_namespace = "Google.Cloud.Logging.V2";
  26. option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "LogEntryProto";
  29. option java_package = "com.google.logging.v2";
  30. option php_namespace = "Google\\Cloud\\Logging\\V2";
  31. option ruby_package = "Google::Cloud::Logging::V2";
  32. // An individual entry in a log.
  33. message LogEntry {
  34. option (google.api.resource) = {
  35. type: "logging.googleapis.com/Log"
  36. pattern: "projects/{project}/logs/{log}"
  37. pattern: "organizations/{organization}/logs/{log}"
  38. pattern: "folders/{folder}/logs/{log}"
  39. pattern: "billingAccounts/{billing_account}/logs/{log}"
  40. name_field: "log_name"
  41. };
  42. // Required. The resource name of the log to which this log entry belongs:
  43. //
  44. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  45. // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
  46. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
  47. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  48. //
  49. // A project number may be used in place of PROJECT_ID. The project number is
  50. // translated to its corresponding PROJECT_ID internally and the `log_name`
  51. // field will contain PROJECT_ID in queries and exports.
  52. //
  53. // `[LOG_ID]` must be URL-encoded within `log_name`. Example:
  54. // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
  55. //
  56. // `[LOG_ID]` must be less than 512 characters long and can only include the
  57. // following characters: upper and lower case alphanumeric characters,
  58. // forward-slash, underscore, hyphen, and period.
  59. //
  60. // For backward compatibility, if `log_name` begins with a forward-slash, such
  61. // as `/projects/...`, then the log entry is ingested as usual, but the
  62. // forward-slash is removed. Listing the log entry will not show the leading
  63. // slash and filtering for a log name with a leading slash will never return
  64. // any results.
  65. string log_name = 12 [(google.api.field_behavior) = REQUIRED];
  66. // Required. The monitored resource that produced this log entry.
  67. //
  68. // Example: a log entry that reports a database error would be associated with
  69. // the monitored resource designating the particular database that reported
  70. // the error.
  71. google.api.MonitoredResource resource = 8 [(google.api.field_behavior) = REQUIRED];
  72. // The log entry payload, which can be one of multiple types.
  73. oneof payload {
  74. // The log entry payload, represented as a protocol buffer. Some Google
  75. // Cloud Platform services use this field for their log entry payloads.
  76. //
  77. // The following protocol buffer types are supported; user-defined types
  78. // are not supported:
  79. //
  80. // "type.googleapis.com/google.cloud.audit.AuditLog"
  81. // "type.googleapis.com/google.appengine.logging.v1.RequestLog"
  82. google.protobuf.Any proto_payload = 2;
  83. // The log entry payload, represented as a Unicode string (UTF-8).
  84. string text_payload = 3;
  85. // The log entry payload, represented as a structure that is
  86. // expressed as a JSON object.
  87. google.protobuf.Struct json_payload = 6;
  88. }
  89. // Optional. The time the event described by the log entry occurred. This time is used
  90. // to compute the log entry's age and to enforce the logs retention period.
  91. // If this field is omitted in a new log entry, then Logging assigns it the
  92. // current time. Timestamps have nanosecond accuracy, but trailing zeros in
  93. // the fractional seconds might be omitted when the timestamp is displayed.
  94. //
  95. // Incoming log entries must have timestamps that don't exceed the
  96. // [logs retention
  97. // period](https://cloud.google.com/logging/quotas#logs_retention_periods) in
  98. // the past, and that don't exceed 24 hours in the future. Log entries outside
  99. // those time boundaries aren't ingested by Logging.
  100. google.protobuf.Timestamp timestamp = 9 [(google.api.field_behavior) = OPTIONAL];
  101. // Output only. The time the log entry was received by Logging.
  102. google.protobuf.Timestamp receive_timestamp = 24 [(google.api.field_behavior) = OUTPUT_ONLY];
  103. // Optional. The severity of the log entry. The default value is `LogSeverity.DEFAULT`.
  104. google.logging.type.LogSeverity severity = 10 [(google.api.field_behavior) = OPTIONAL];
  105. // Optional. A unique identifier for the log entry. If you provide a value, then
  106. // Logging considers other log entries in the same project, with the same
  107. // `timestamp`, and with the same `insert_id` to be duplicates which are
  108. // removed in a single query result. However, there are no guarantees of
  109. // de-duplication in the export of logs.
  110. //
  111. // If the `insert_id` is omitted when writing a log entry, the Logging API
  112. // assigns its own unique identifier in this field.
  113. //
  114. // In queries, the `insert_id` is also used to order log entries that have
  115. // the same `log_name` and `timestamp` values.
  116. string insert_id = 4 [(google.api.field_behavior) = OPTIONAL];
  117. // Optional. Information about the HTTP request associated with this log entry, if
  118. // applicable.
  119. google.logging.type.HttpRequest http_request = 7 [(google.api.field_behavior) = OPTIONAL];
  120. // Optional. A map of key, value pairs that provides additional information about the
  121. // log entry. The labels can be user-defined or system-defined.
  122. //
  123. // User-defined labels are arbitrary key, value pairs that you can use to
  124. // classify logs.
  125. //
  126. // System-defined labels are defined by GCP services for platform logs.
  127. // They have two components - a service namespace component and the
  128. // attribute name. For example: `compute.googleapis.com/resource_name`.
  129. //
  130. // Cloud Logging truncates label keys that exceed 512 B and label
  131. // values that exceed 64 KB upon their associated log entry being
  132. // written. The truncation is indicated by an ellipsis at the
  133. // end of the character string.
  134. map<string, string> labels = 11 [(google.api.field_behavior) = OPTIONAL];
  135. // Optional. Information about an operation associated with the log entry, if
  136. // applicable.
  137. LogEntryOperation operation = 15 [(google.api.field_behavior) = OPTIONAL];
  138. // Optional. Resource name of the trace associated with the log entry, if any. If it
  139. // contains a relative resource name, the name is assumed to be relative to
  140. // `//tracing.googleapis.com`. Example:
  141. // `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
  142. string trace = 22 [(google.api.field_behavior) = OPTIONAL];
  143. // Optional. The span ID within the trace associated with the log entry.
  144. //
  145. // For Trace spans, this is the same format that the Trace API v2 uses: a
  146. // 16-character hexadecimal encoding of an 8-byte array, such as
  147. // `000000000000004a`.
  148. string span_id = 27 [(google.api.field_behavior) = OPTIONAL];
  149. // Optional. The sampling decision of the trace associated with the log entry.
  150. //
  151. // True means that the trace resource name in the `trace` field was sampled
  152. // for storage in a trace backend. False means that the trace was not sampled
  153. // for storage when this log entry was written, or the sampling decision was
  154. // unknown at the time. A non-sampled `trace` value is still useful as a
  155. // request correlation identifier. The default is False.
  156. bool trace_sampled = 30 [(google.api.field_behavior) = OPTIONAL];
  157. // Optional. Source code location information associated with the log entry, if any.
  158. LogEntrySourceLocation source_location = 23 [(google.api.field_behavior) = OPTIONAL];
  159. // Optional. Information indicating this LogEntry is part of a sequence of multiple log
  160. // entries split from a single LogEntry.
  161. LogSplit split = 35 [(google.api.field_behavior) = OPTIONAL];
  162. }
  163. // Additional information about a potentially long-running operation with which
  164. // a log entry is associated.
  165. message LogEntryOperation {
  166. // Optional. An arbitrary operation identifier. Log entries with the same
  167. // identifier are assumed to be part of the same operation.
  168. string id = 1 [(google.api.field_behavior) = OPTIONAL];
  169. // Optional. An arbitrary producer identifier. The combination of `id` and
  170. // `producer` must be globally unique. Examples for `producer`:
  171. // `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
  172. string producer = 2 [(google.api.field_behavior) = OPTIONAL];
  173. // Optional. Set this to True if this is the first log entry in the operation.
  174. bool first = 3 [(google.api.field_behavior) = OPTIONAL];
  175. // Optional. Set this to True if this is the last log entry in the operation.
  176. bool last = 4 [(google.api.field_behavior) = OPTIONAL];
  177. }
  178. // Additional information about the source code location that produced the log
  179. // entry.
  180. message LogEntrySourceLocation {
  181. // Optional. Source file name. Depending on the runtime environment, this
  182. // might be a simple name or a fully-qualified name.
  183. string file = 1 [(google.api.field_behavior) = OPTIONAL];
  184. // Optional. Line within the source file. 1-based; 0 indicates no line number
  185. // available.
  186. int64 line = 2 [(google.api.field_behavior) = OPTIONAL];
  187. // Optional. Human-readable name of the function or method being invoked, with
  188. // optional context such as the class or package name. This information may be
  189. // used in contexts such as the logs viewer, where a file and line number are
  190. // less meaningful. The format can vary by language. For example:
  191. // `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
  192. // (Python).
  193. string function = 3 [(google.api.field_behavior) = OPTIONAL];
  194. }
  195. // Additional information used to correlate multiple log entries. Used when a
  196. // single LogEntry would exceed the Google Cloud Logging size limit and is
  197. // split across multiple log entries.
  198. message LogSplit {
  199. // A globally unique identifier for all log entries in a sequence of split log
  200. // entries. All log entries with the same |LogSplit.uid| are assumed to be
  201. // part of the same sequence of split log entries.
  202. string uid = 1;
  203. // The index of this LogEntry in the sequence of split log entries. Log
  204. // entries are given |index| values 0, 1, ..., n-1 for a sequence of n log
  205. // entries.
  206. int32 index = 2;
  207. // The total number of log entries that the original LogEntry was split into.
  208. int32 total_splits = 3;
  209. }