go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/logdog/api/endpoints/coordinator/logs/v1/logs.proto (about)

     1  // Copyright 2016 The LUCI Authors. All rights reserved.
     2  // Use of this source code is governed under the Apache License, Version 2.0
     3  // that can be found in the LICENSE file.
     4  
     5  syntax = "proto3";
     6  
     7  package logdog;
     8  
     9  option go_package = "go.chromium.org/luci/logdog/api/endpoints/coordinator/logs/v1;logdog";
    10  
    11  import "go.chromium.org/luci/logdog/api/endpoints/coordinator/logs/v1/state.proto";
    12  import "go.chromium.org/luci/logdog/api/logpb/log.proto";
    13  import "google/protobuf/timestamp.proto";
    14  import "google/protobuf/duration.proto";
    15  
    16  // GetRequest is the request structure for the user Get endpoint.
    17  //
    18  // If the requested log stream exists, a valid GetRequest will succeed
    19  // regardless of whether the requested log range was available.
    20  //
    21  // Note that this endpoint may return fewer logs than requested due to either
    22  // availability or internal constraints.
    23  message GetRequest {
    24    // The request project to request.
    25    string project = 1;
    26    // The path of the log stream to get.
    27    //
    28    // This can either be a LogDog stream path or the SHA256 hash of a LogDog
    29    // stream path.
    30    //
    31    // Some utilities may find passing around a full LogDog path to be cumbersome
    32    // due to its length. They can opt to pass around the hash instead and
    33    // retrieve logs using it.
    34    string path = 2;
    35  
    36    // If true, requests that the log stream's state is returned.
    37    bool state = 3;
    38  
    39    // The initial log stream index to retrieve.
    40    int64 index = 4;
    41  
    42    // The maximum number of bytes to return. If non-zero, it is applied as a
    43    // constraint to limit the number of logs that are returned.
    44    //
    45    // This only returns complete logs. Assuming logs are available, it will
    46    // return at least one log (even if it violates the size constraint) and as
    47    // many additional logs as it can without exceeding this constraint.
    48    int32 byte_count = 5;
    49  
    50    // The maximum number of log records to request.
    51    //
    52    // If this value is zero, no count constraint will be applied. If this value
    53    // is less than zero, no log entries will be returned. This can be used to
    54    // fetch log stream descriptors without fetching any log records.
    55    int32 log_count = 6;
    56  
    57    // If true, allows the range request to return non-contiguous records.
    58    //
    59    // A contiguous request (default) will iterate forwards from the supplied
    60    // Index and stop if either the end of stream is encountered or there is a
    61    // missing stream index. A NonContiguous request will remove the latter
    62    // condition.
    63    //
    64    // For example, say the log stream consists of:
    65    // [3, 4, 6, 7]
    66    //
    67    // A contiguous request with Index 3 will return: [3, 4], stopping because
    68    // 5 is missing. A non-contiguous request will return [3, 4, 6, 7].
    69    bool non_contiguous = 7;
    70  
    71    // If supplied, the response will contain a SignedUrls message with the
    72    // requested signed URLs. If signed URLs are not supported by the log's
    73    // current storage system, the response message will be empty.
    74    message SignURLRequest {
    75      // The lifetime that the signed URL will be bound to.. The
    76      google.protobuf.Duration lifetime = 1;
    77  
    78      // Return a signed URL for the log's RecordIO protobuf data.
    79      bool stream = 2;
    80      // Return a signed URL for the log's LogIndex protobuf.
    81      bool index = 3;
    82    }
    83    SignURLRequest get_signed_urls = 8;
    84  }
    85  
    86  // TailRequest is the request structure for the user Tail endpoint. It returns
    87  // the last log in a given log stream at the time of the request.
    88  message TailRequest {
    89    // The request project to request.
    90    string project = 1;
    91    // The path of the log stream to get.
    92    //
    93    // This can either be a LogDog stream path or the SHA256 hash of a LogDog
    94    // stream path.
    95    //
    96    // Some utilities may find passing around a full LogDog path to be cumbersome
    97    // due to its length. They can opt to pass around the hash instead and
    98    // retrieve logs using it.
    99    string path = 2;
   100  
   101    // If true, requests that the log stream's state is returned.
   102    bool state = 3;
   103  }
   104  
   105  // GetResponse is the response structure for the user Get endpoint.
   106  message GetResponse {
   107    // Project is the project name that these logs belong to.
   108    string project = 1;
   109  
   110    // Realm is the realm (within the project) the stream is associated with.
   111    string realm = 6;
   112  
   113    // The log stream descriptor and state for this stream.
   114    //
   115    // It can be requested by setting the request's State field to true. If the
   116    // Proto field is true, the State's Descriptor field will not be included.
   117    LogStreamState state = 2;
   118  
   119    // The expanded LogStreamDescriptor protobuf. It is intended for JSON
   120    // consumption.
   121    //
   122    // If the GetRequest's Proto field is false, this will be populated;
   123    // otherwise, the serialized protobuf will be written to the DescriptorProto
   124    // field.
   125    logpb.LogStreamDescriptor desc = 3;
   126  
   127    // Log represents the set of retrieved log records.
   128    repeated logpb.LogEntry logs = 4;
   129  
   130    // Holds information about the log stream's signed entry URL.
   131    message SignedUrls {
   132      // The time when this signed URL will expire.
   133      google.protobuf.Timestamp expiration = 1;
   134  
   135      // The signed log stream URL, if requested.
   136      string stream = 2;
   137      // The signed log index URL, if requested.
   138      string index = 3;
   139    }
   140    // An optional signed log entry RecordIO protobuf URL, if requested via
   141    // "sign_entry_url_lifetime".
   142    SignedUrls signed_urls = 5;
   143  }
   144  
   145  // QueryRequest is the request structure for the user Query endpoint.
   146  message QueryRequest {
   147    // Trinary represents a trinary value.
   148    enum Trinary {
   149      // Both positive and negative results will be returned.
   150      BOTH = 0;
   151      // Only positive results will be returned.
   152      YES = 1;
   153      // Only negative results will be returned.
   154      NO = 2;
   155    }
   156  
   157    // (required) The project to query from.
   158    string project = 1;
   159  
   160    // (required) The stream query parameter.
   161    //
   162    // Paths are of the form "full/path/prefix/+/stream/name", where the
   163    // "stream/name" portion can contain glob-style "*" and "**" operators.
   164    //
   165    // If this is just "full/path/prefix", then the stream/name is assumed to be
   166    // "**" (meaning all streams).
   167    //
   168    // Omitting the full path prefix is an error (no wildcards are permitted).
   169    string path = 2;
   170  
   171    // If true, returns that the streams' full state is returned instead of just
   172    // its Path.
   173    bool state = 3;
   174  
   175    // If true, causes the requested state to be returned as serialized protobuf
   176    // data instead of deserialized JSON structures.
   177    bool proto = 4;
   178  
   179    // Next, if not empty, indicates that this query should continue at the point
   180    // where the previous query left off.
   181    string next = 5;
   182  
   183    // MaxResults is the maximum number of query results to return.
   184    //
   185    // If MaxResults is zero, no upper bound will be indicated. However, the
   186    // returned result count is still be subject to internal constraints.
   187    int32 max_results = 6;
   188  
   189    // ContentType, if not empty, restricts results to streams with the supplied
   190    // content type.
   191    string content_type = 10;
   192  
   193    // The stream type to filter on.
   194    message StreamTypeFilter {
   195      // The StreamType value to filter on.
   196      logpb.StreamType value = 1;
   197    }
   198    StreamTypeFilter stream_type = 11;
   199  
   200    // [DEPRECATED] `newer` restricts results to streams created after the specified date.
   201    reserved "newer";
   202    reserved 12;
   203  
   204    // [DEPRECATED] `older` restricts results to streams created before the specified date.
   205    reserved "older";
   206    reserved 13;
   207  
   208    // [DEPRECATED] If not empty, constrains the results to those whose protobuf
   209    // version string matches the supplied version.
   210    reserved "proto_version";
   211    reserved 14;
   212  
   213    // Tags is the set of tags to constrain the query with.
   214    //
   215    // A Tag entry may either be:
   216    // - A key/value query, in which case the results are constrained by logs
   217    //   whose tag includes that key/value pair.
   218    // - A key with an missing (nil) value, in which case the results are
   219    //   constraints by logs that have that tag key, regardless of its value.
   220    map<string, string> tags = 15;
   221  
   222    // Purged restricts the query to streams that have or haven't been purged.
   223    Trinary purged = 16;
   224  }
   225  
   226  // QueryResponse is the response structure for the user Query endpoint.
   227  message QueryResponse {
   228    // Project is the project name that all responses belong to.
   229    string project = 1;
   230  
   231    // Realm is the realm (within the project) all streams are associated with.
   232    string realm = 4;
   233  
   234    // Stream represents a single query response stream.
   235    message Stream {
   236      // Path is the log stream path.
   237      string path = 1;
   238  
   239      // State is the log stream descriptor and state for this stream.
   240      //
   241      // It can be requested by setting the request's State field to true. If the
   242      // Proto field is true, the State's Descriptor field will not be included.
   243      LogStreamState state = 2;
   244  
   245      // The JSON-packed log stream descriptor protobuf.
   246      //
   247      // A Descriptor entry corresponds to the Path with the same index.
   248      //
   249      // If the query request's State field is set, the descriptor will be
   250      // populated. If the Proto field is false, Descriptor will be populated;
   251      // otherwise, DescriptorProto will be populated with the serialized descriptor
   252      // protobuf.
   253      logpb.LogStreamDescriptor desc = 3;
   254      // The serialized log stream Descriptor protobuf.
   255      bytes desc_proto= 4;
   256    }
   257  
   258    // The list of streams that were identified as the result of the query.
   259    repeated Stream streams = 2;
   260  
   261    // If not empty, indicates that there are more query results available.
   262    // These results can be requested by repeating the Query request with the
   263    // same Path field and supplying this value in the Next field.
   264    string next = 3;
   265  }
   266  
   267  // Logs is the user-facing log access and query endpoint service.
   268  service Logs {
   269    // Get returns state and log data for a single log stream.
   270    rpc Get(GetRequest) returns (GetResponse);
   271  
   272    // Tail returns the last log in the log stream at the time of the request.
   273    rpc Tail(TailRequest) returns (GetResponse);
   274  
   275    // Query returns log stream paths that match the requested query.
   276    rpc Query(QueryRequest) returns (QueryResponse);
   277  }