log_entry.proto 9.6 KB

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