logging.proto 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/monitored_resource.proto";
  20. import "google/api/resource.proto";
  21. import "google/logging/v2/log_entry.proto";
  22. import "google/protobuf/duration.proto";
  23. import "google/protobuf/empty.proto";
  24. import "google/rpc/status.proto";
  25. option cc_enable_arenas = true;
  26. option csharp_namespace = "Google.Cloud.Logging.V2";
  27. option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging";
  28. option java_multiple_files = true;
  29. option java_outer_classname = "LoggingProto";
  30. option java_package = "com.google.logging.v2";
  31. option php_namespace = "Google\\Cloud\\Logging\\V2";
  32. option ruby_package = "Google::Cloud::Logging::V2";
  33. // Service for ingesting and querying logs.
  34. service LoggingServiceV2 {
  35. option (google.api.default_host) = "logging.googleapis.com";
  36. option (google.api.oauth_scopes) =
  37. "https://www.googleapis.com/auth/cloud-platform,"
  38. "https://www.googleapis.com/auth/cloud-platform.read-only,"
  39. "https://www.googleapis.com/auth/logging.admin,"
  40. "https://www.googleapis.com/auth/logging.read,"
  41. "https://www.googleapis.com/auth/logging.write";
  42. // Deletes all the log entries in a log for the _Default Log Bucket. The log
  43. // reappears if it receives new entries. Log entries written shortly before
  44. // the delete operation might not be deleted. Entries received after the
  45. // delete operation with a timestamp before the operation will be deleted.
  46. rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) {
  47. option (google.api.http) = {
  48. delete: "/v2/{log_name=projects/*/logs/*}"
  49. additional_bindings {
  50. delete: "/v2/{log_name=*/*/logs/*}"
  51. }
  52. additional_bindings {
  53. delete: "/v2/{log_name=organizations/*/logs/*}"
  54. }
  55. additional_bindings {
  56. delete: "/v2/{log_name=folders/*/logs/*}"
  57. }
  58. additional_bindings {
  59. delete: "/v2/{log_name=billingAccounts/*/logs/*}"
  60. }
  61. };
  62. option (google.api.method_signature) = "log_name";
  63. }
  64. // Writes log entries to Logging. This API method is the
  65. // only way to send log entries to Logging. This method
  66. // is used, directly or indirectly, by the Logging agent
  67. // (fluentd) and all logging libraries configured to use Logging.
  68. // A single request may contain log entries for a maximum of 1000
  69. // different resources (projects, organizations, billing accounts or
  70. // folders)
  71. rpc WriteLogEntries(WriteLogEntriesRequest) returns (WriteLogEntriesResponse) {
  72. option (google.api.http) = {
  73. post: "/v2/entries:write"
  74. body: "*"
  75. };
  76. option (google.api.method_signature) = "log_name,resource,labels,entries";
  77. }
  78. // Lists log entries. Use this method to retrieve log entries that originated
  79. // from a project/folder/organization/billing account. For ways to export log
  80. // entries, see [Exporting
  81. // Logs](https://cloud.google.com/logging/docs/export).
  82. rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) {
  83. option (google.api.http) = {
  84. post: "/v2/entries:list"
  85. body: "*"
  86. };
  87. option (google.api.method_signature) = "resource_names,filter,order_by";
  88. }
  89. // Lists the descriptors for monitored resource types used by Logging.
  90. rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) {
  91. option (google.api.http) = {
  92. get: "/v2/monitoredResourceDescriptors"
  93. };
  94. }
  95. // Lists the logs in projects, organizations, folders, or billing accounts.
  96. // Only logs that have entries are listed.
  97. rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) {
  98. option (google.api.http) = {
  99. get: "/v2/{parent=*/*}/logs"
  100. additional_bindings {
  101. get: "/v2/{parent=projects/*}/logs"
  102. }
  103. additional_bindings {
  104. get: "/v2/{parent=organizations/*}/logs"
  105. }
  106. additional_bindings {
  107. get: "/v2/{parent=folders/*}/logs"
  108. }
  109. additional_bindings {
  110. get: "/v2/{parent=billingAccounts/*}/logs"
  111. }
  112. };
  113. option (google.api.method_signature) = "parent";
  114. }
  115. // Streaming read of log entries as they are ingested. Until the stream is
  116. // terminated, it will continue reading logs.
  117. rpc TailLogEntries(stream TailLogEntriesRequest) returns (stream TailLogEntriesResponse) {
  118. option (google.api.http) = {
  119. post: "/v2/entries:tail"
  120. body: "*"
  121. };
  122. }
  123. }
  124. // The parameters to DeleteLog.
  125. message DeleteLogRequest {
  126. // Required. The resource name of the log to delete:
  127. //
  128. // * `projects/[PROJECT_ID]/logs/[LOG_ID]`
  129. // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]`
  130. // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]`
  131. // * `folders/[FOLDER_ID]/logs/[LOG_ID]`
  132. //
  133. // `[LOG_ID]` must be URL-encoded. For example,
  134. // `"projects/my-project-id/logs/syslog"`,
  135. // `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`.
  136. //
  137. // For more information about log names, see
  138. // [LogEntry][google.logging.v2.LogEntry].
  139. string log_name = 1 [
  140. (google.api.field_behavior) = REQUIRED,
  141. (google.api.resource_reference) = {
  142. type: "logging.googleapis.com/Log"
  143. }
  144. ];
  145. }
  146. // The parameters to WriteLogEntries.
  147. message WriteLogEntriesRequest {
  148. // Optional. A default log resource name that is assigned to all log entries
  149. // in `entries` that do not specify a value for `log_name`:
  150. //
  151. // * `projects/[PROJECT_ID]/logs/[LOG_ID]`
  152. // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]`
  153. // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]`
  154. // * `folders/[FOLDER_ID]/logs/[LOG_ID]`
  155. //
  156. // `[LOG_ID]` must be URL-encoded. For example:
  157. //
  158. // "projects/my-project-id/logs/syslog"
  159. // "organizations/123/logs/cloudaudit.googleapis.com%2Factivity"
  160. //
  161. // The permission `logging.logEntries.create` is needed on each project,
  162. // organization, billing account, or folder that is receiving new log
  163. // entries, whether the resource is specified in `logName` or in an
  164. // individual log entry.
  165. string log_name = 1 [
  166. (google.api.field_behavior) = OPTIONAL,
  167. (google.api.resource_reference) = {
  168. type: "logging.googleapis.com/Log"
  169. }
  170. ];
  171. // Optional. A default monitored resource object that is assigned to all log
  172. // entries in `entries` that do not specify a value for `resource`. Example:
  173. //
  174. // { "type": "gce_instance",
  175. // "labels": {
  176. // "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
  177. //
  178. // See [LogEntry][google.logging.v2.LogEntry].
  179. google.api.MonitoredResource resource = 2 [(google.api.field_behavior) = OPTIONAL];
  180. // Optional. Default labels that are added to the `labels` field of all log
  181. // entries in `entries`. If a log entry already has a label with the same key
  182. // as a label in this parameter, then the log entry's label is not changed.
  183. // See [LogEntry][google.logging.v2.LogEntry].
  184. map<string, string> labels = 3 [(google.api.field_behavior) = OPTIONAL];
  185. // Required. The log entries to send to Logging. The order of log
  186. // entries in this list does not matter. Values supplied in this method's
  187. // `log_name`, `resource`, and `labels` fields are copied into those log
  188. // entries in this list that do not include values for their corresponding
  189. // fields. For more information, see the
  190. // [LogEntry][google.logging.v2.LogEntry] type.
  191. //
  192. // If the `timestamp` or `insert_id` fields are missing in log entries, then
  193. // this method supplies the current time or a unique identifier, respectively.
  194. // The supplied values are chosen so that, among the log entries that did not
  195. // supply their own values, the entries earlier in the list will sort before
  196. // the entries later in the list. See the `entries.list` method.
  197. //
  198. // Log entries with timestamps that are more than the
  199. // [logs retention period](https://cloud.google.com/logging/quotas) in
  200. // the past or more than 24 hours in the future will not be available when
  201. // calling `entries.list`. However, those log entries can still be [exported
  202. // with
  203. // LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
  204. //
  205. // To improve throughput and to avoid exceeding the
  206. // [quota limit](https://cloud.google.com/logging/quotas) for calls to
  207. // `entries.write`, you should try to include several log entries in this
  208. // list, rather than calling this method for each individual log entry.
  209. repeated LogEntry entries = 4 [(google.api.field_behavior) = REQUIRED];
  210. // Optional. Whether valid entries should be written even if some other
  211. // entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any
  212. // entry is not written, then the response status is the error associated
  213. // with one of the failed entries and the response includes error details
  214. // keyed by the entries' zero-based index in the `entries.write` method.
  215. bool partial_success = 5 [(google.api.field_behavior) = OPTIONAL];
  216. // Optional. If true, the request should expect normal response, but the
  217. // entries won't be persisted nor exported. Useful for checking whether the
  218. // logging API endpoints are working properly before sending valuable data.
  219. bool dry_run = 6 [(google.api.field_behavior) = OPTIONAL];
  220. }
  221. // Result returned from WriteLogEntries.
  222. message WriteLogEntriesResponse {
  223. }
  224. // Error details for WriteLogEntries with partial success.
  225. message WriteLogEntriesPartialErrors {
  226. // When `WriteLogEntriesRequest.partial_success` is true, records the error
  227. // status for entries that were not written due to a permanent error, keyed
  228. // by the entry's zero-based index in `WriteLogEntriesRequest.entries`.
  229. //
  230. // Failed requests for which no entries are written will not include
  231. // per-entry errors.
  232. map<int32, google.rpc.Status> log_entry_errors = 1;
  233. }
  234. // The parameters to `ListLogEntries`.
  235. message ListLogEntriesRequest {
  236. // Required. Names of one or more parent resources from which to
  237. // retrieve log entries:
  238. //
  239. // * `projects/[PROJECT_ID]`
  240. // * `organizations/[ORGANIZATION_ID]`
  241. // * `billingAccounts/[BILLING_ACCOUNT_ID]`
  242. // * `folders/[FOLDER_ID]`
  243. //
  244. // May alternatively be one or more views:
  245. //
  246. // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  247. // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  248. // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  249. // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  250. //
  251. // Projects listed in the `project_ids` field are added to this list.
  252. repeated string resource_names = 8 [
  253. (google.api.field_behavior) = REQUIRED,
  254. (google.api.resource_reference) = {
  255. child_type: "logging.googleapis.com/Log"
  256. }
  257. ];
  258. // Optional. A filter that chooses which log entries to return. See [Advanced
  259. // Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries).
  260. // Only log entries that match the filter are returned. An empty filter
  261. // matches all log entries in the resources listed in `resource_names`.
  262. // Referencing a parent resource that is not listed in `resource_names` will
  263. // cause the filter to return no results. The maximum length of the filter is
  264. // 20000 characters.
  265. string filter = 2 [(google.api.field_behavior) = OPTIONAL];
  266. // Optional. How the results should be sorted. Presently, the only permitted
  267. // values are `"timestamp asc"` (default) and `"timestamp desc"`. The first
  268. // option returns entries in order of increasing values of
  269. // `LogEntry.timestamp` (oldest first), and the second option returns entries
  270. // in order of decreasing timestamps (newest first). Entries with equal
  271. // timestamps are returned in order of their `insert_id` values.
  272. string order_by = 3 [(google.api.field_behavior) = OPTIONAL];
  273. // Optional. The maximum number of results to return from this request. Default is 50.
  274. // If the value is negative or exceeds 1000, the request is rejected. The
  275. // presence of `next_page_token` in the response indicates that more results
  276. // might be available.
  277. int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL];
  278. // Optional. If present, then retrieve the next batch of results from the
  279. // preceding call to this method. `page_token` must be the value of
  280. // `next_page_token` from the previous response. The values of other method
  281. // parameters should be identical to those in the previous call.
  282. string page_token = 5 [(google.api.field_behavior) = OPTIONAL];
  283. }
  284. // Result returned from `ListLogEntries`.
  285. message ListLogEntriesResponse {
  286. // A list of log entries. If `entries` is empty, `nextPageToken` may still be
  287. // returned, indicating that more entries may exist. See `nextPageToken` for
  288. // more information.
  289. repeated LogEntry entries = 1;
  290. // If there might be more results than those appearing in this response, then
  291. // `nextPageToken` is included. To get the next set of results, call this
  292. // method again using the value of `nextPageToken` as `pageToken`.
  293. //
  294. // If a value for `next_page_token` appears and the `entries` field is empty,
  295. // it means that the search found no log entries so far but it did not have
  296. // time to search all the possible log entries. Retry the method with this
  297. // value for `page_token` to continue the search. Alternatively, consider
  298. // speeding up the search by changing your filter to specify a single log name
  299. // or resource type, or to narrow the time range of the search.
  300. string next_page_token = 2;
  301. }
  302. // The parameters to ListMonitoredResourceDescriptors
  303. message ListMonitoredResourceDescriptorsRequest {
  304. // Optional. The maximum number of results to return from this request.
  305. // Non-positive values are ignored. The presence of `nextPageToken` in the
  306. // response indicates that more results might be available.
  307. int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
  308. // Optional. If present, then retrieve the next batch of results from the
  309. // preceding call to this method. `pageToken` must be the value of
  310. // `nextPageToken` from the previous response. The values of other method
  311. // parameters should be identical to those in the previous call.
  312. string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
  313. }
  314. // Result returned from ListMonitoredResourceDescriptors.
  315. message ListMonitoredResourceDescriptorsResponse {
  316. // A list of resource descriptors.
  317. repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1;
  318. // If there might be more results than those appearing in this response, then
  319. // `nextPageToken` is included. To get the next set of results, call this
  320. // method again using the value of `nextPageToken` as `pageToken`.
  321. string next_page_token = 2;
  322. }
  323. // The parameters to ListLogs.
  324. message ListLogsRequest {
  325. // Required. The resource name that owns the logs:
  326. //
  327. // * `projects/[PROJECT_ID]`
  328. // * `organizations/[ORGANIZATION_ID]`
  329. // * `billingAccounts/[BILLING_ACCOUNT_ID]`
  330. // * `folders/[FOLDER_ID]`
  331. string parent = 1 [
  332. (google.api.field_behavior) = REQUIRED,
  333. (google.api.resource_reference) = {
  334. child_type: "logging.googleapis.com/Log"
  335. }
  336. ];
  337. // Optional. The maximum number of results to return from this request.
  338. // Non-positive values are ignored. The presence of `nextPageToken` in the
  339. // response indicates that more results might be available.
  340. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  341. // Optional. If present, then retrieve the next batch of results from the
  342. // preceding call to this method. `pageToken` must be the value of
  343. // `nextPageToken` from the previous response. The values of other method
  344. // parameters should be identical to those in the previous call.
  345. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  346. // Optional. The resource name that owns the logs:
  347. //
  348. // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  349. // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  350. // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  351. // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  352. //
  353. // To support legacy queries, it could also be:
  354. //
  355. // * `projects/[PROJECT_ID]`
  356. // * `organizations/[ORGANIZATION_ID]`
  357. // * `billingAccounts/[BILLING_ACCOUNT_ID]`
  358. // * `folders/[FOLDER_ID]`
  359. repeated string resource_names = 8 [
  360. (google.api.field_behavior) = OPTIONAL,
  361. (google.api.resource_reference) = {
  362. child_type: "logging.googleapis.com/Log"
  363. }
  364. ];
  365. }
  366. // Result returned from ListLogs.
  367. message ListLogsResponse {
  368. // A list of log names. For example,
  369. // `"projects/my-project/logs/syslog"` or
  370. // `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
  371. repeated string log_names = 3;
  372. // If there might be more results than those appearing in this response, then
  373. // `nextPageToken` is included. To get the next set of results, call this
  374. // method again using the value of `nextPageToken` as `pageToken`.
  375. string next_page_token = 2;
  376. }
  377. // The parameters to `TailLogEntries`.
  378. message TailLogEntriesRequest {
  379. // Required. Name of a parent resource from which to retrieve log entries:
  380. //
  381. // * `projects/[PROJECT_ID]`
  382. // * `organizations/[ORGANIZATION_ID]`
  383. // * `billingAccounts/[BILLING_ACCOUNT_ID]`
  384. // * `folders/[FOLDER_ID]`
  385. //
  386. // May alternatively be one or more views:
  387. //
  388. // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  389. // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  390. // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  391. // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
  392. repeated string resource_names = 1 [(google.api.field_behavior) = REQUIRED];
  393. // Optional. A filter that chooses which log entries to return. See [Advanced
  394. // Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
  395. // Only log entries that match the filter are returned. An empty filter
  396. // matches all log entries in the resources listed in `resource_names`.
  397. // Referencing a parent resource that is not in `resource_names` will cause
  398. // the filter to return no results. The maximum length of the filter is 20000
  399. // characters.
  400. string filter = 2 [(google.api.field_behavior) = OPTIONAL];
  401. // Optional. The amount of time to buffer log entries at the server before
  402. // being returned to prevent out of order results due to late arriving log
  403. // entries. Valid values are between 0-60000 milliseconds. Defaults to 2000
  404. // milliseconds.
  405. google.protobuf.Duration buffer_window = 3 [(google.api.field_behavior) = OPTIONAL];
  406. }
  407. // Result returned from `TailLogEntries`.
  408. message TailLogEntriesResponse {
  409. // Information about entries that were omitted from the session.
  410. message SuppressionInfo {
  411. // An indicator of why entries were omitted.
  412. enum Reason {
  413. // Unexpected default.
  414. REASON_UNSPECIFIED = 0;
  415. // Indicates suppression occurred due to relevant entries being
  416. // received in excess of rate limits. For quotas and limits, see
  417. // [Logging API quotas and
  418. // limits](https://cloud.google.com/logging/quotas#api-limits).
  419. RATE_LIMIT = 1;
  420. // Indicates suppression occurred due to the client not consuming
  421. // responses quickly enough.
  422. NOT_CONSUMED = 2;
  423. }
  424. // The reason that entries were omitted from the session.
  425. Reason reason = 1;
  426. // A lower bound on the count of entries omitted due to `reason`.
  427. int32 suppressed_count = 2;
  428. }
  429. // A list of log entries. Each response in the stream will order entries with
  430. // increasing values of `LogEntry.timestamp`. Ordering is not guaranteed
  431. // between separate responses.
  432. repeated LogEntry entries = 1;
  433. // If entries that otherwise would have been included in the session were not
  434. // sent back to the client, counts of relevant entries omitted from the
  435. // session with the reason that they were not included. There will be at most
  436. // one of each reason per response. The counts represent the number of
  437. // suppressed entries since the last streamed response.
  438. repeated SuppressionInfo suppression_info = 2;
  439. }