logging.proto 21 KB

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