go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/logdog/api/logpb/log.proto (about) 1 // Copyright 2015 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 logpb; 8 9 option go_package = "go.chromium.org/luci/logdog/api/logpb"; 10 11 import "google/protobuf/timestamp.proto"; 12 import "google/protobuf/duration.proto"; 13 14 /* A log stream type. */ 15 enum StreamType { 16 TEXT = 0; 17 BINARY = 1; 18 DATAGRAM = 2; 19 } 20 21 /** 22 * Log stream descriptor data. This is the full set of information that 23 * describes a logging stream. 24 */ 25 message LogStreamDescriptor { 26 /* 27 * The stream's prefix (required). 28 * 29 * Logs originating from the same Butler instance will share a Prefix. 30 * 31 * A valid prefix value is a StreamName described in: 32 * https://go.chromium.org/luci/logdog/common/types#StreamName 33 */ 34 string prefix = 1; 35 /* 36 * The log stream's name (required). 37 * 38 * This is used to uniquely identify a log stream within the scope of its 39 * prefix. 40 * 41 * A valid name value is a StreamName described in: 42 * https://go.chromium.org/luci/logdog/common/types#StreamName 43 */ 44 string name = 2; 45 46 /* The log stream's content type (required). */ 47 StreamType stream_type = 3; 48 49 /* 50 * The stream's content type (required). 51 * 52 * This must be an HTTP Content-Type value. Begins with MIME media type; may 53 * include a charset directive. It is made available to LogDog clients when 54 * querying stream metadata. It will also be applied to archived binary log 55 * data. 56 */ 57 string content_type = 4; 58 59 /* 60 * The log stream's base timestamp (required). 61 * 62 * This notes the start time of the log stream. All LogEntries express their 63 * timestamp as microsecond offsets from this field. 64 */ 65 google.protobuf.Timestamp timestamp = 5; 66 67 /* 68 * Tag is an arbitrary key/value tag associated with this log stream. 69 * 70 * LogDog clients can query for log streams based on tag values. 71 */ 72 map<string, string> tags = 6; 73 74 /* 75 * If set, the stream will be joined together during archival to recreate the 76 * original stream and made available at <prefix>/+/<name>.ext. 77 */ 78 string binary_file_ext = 7; 79 } 80 81 /* Text stream content. */ 82 message Text { 83 /* 84 * Contiguous text lines and their delimiters. 85 * 86 * The array of lines follows the following pattern: 87 * - 0 or 1 completion lines completing the last LogEntry's Text (i.e. with 88 * a delimiter but not itself the full line) 89 * - any number of complete lines (i.e. with delimiter, each its own line) 90 * - 0 or 1 partial lines 91 */ 92 message Line { 93 /* The line's text content, not including its delimiter. */ 94 bytes value = 1; 95 96 /* 97 * The line's delimiter string. 98 * 99 * If this is an empty string, this line is continued in the next sequential 100 * line, and the line's sequence number does not advance. 101 */ 102 string delimiter = 2; 103 } 104 repeated Line lines = 1; 105 } 106 107 /* Binary stream content. */ 108 message Binary { 109 // Formerly the LogEntry.Sequence value was duplicated here. 110 reserved 1; 111 112 /* The binary stream's data. */ 113 bytes data = 2; 114 } 115 116 /* Datagram stream content type. */ 117 message Datagram { 118 /* This datagram data. */ 119 bytes data = 1; 120 121 /* 122 * If this is not a partial datagram, this field will include reassembly and 123 * state details for the full datagram. 124 */ 125 message Partial { 126 /* 127 * The index, starting with zero, of this datagram fragment in the full 128 * datagram. 129 */ 130 uint32 index = 1; 131 132 /* The size of the full datagram */ 133 uint64 size = 2; 134 135 /* If true, this is the last partial datagram in the overall datagram. */ 136 bool last = 3; 137 } 138 Partial partial = 2; 139 } 140 141 /** 142 * An individual log entry. 143 * 144 * This contains the superset of transmissible log data. Its content fields 145 * should be interpreted in the context of the log stream's content type. 146 */ 147 message LogEntry { 148 /* 149 * The stream time offset for this content. 150 * 151 * This offset is added to the log stream's base "timestamp" to resolve the 152 * timestamp for this specific Content. 153 */ 154 google.protobuf.Duration time_offset = 1; 155 156 /* 157 * The message index within the Prefix (required). 158 * 159 * This is value is unique to this LogEntry across the entire set of entries 160 * sharing the stream's Prefix. It is used to designate unambiguous log 161 * ordering. 162 */ 163 uint64 prefix_index = 2; 164 165 /* 166 * The message index within its Stream (required). 167 * 168 * This value is unique across all entries sharing the same Prefix and Stream 169 * Name. It is used to designate unambiguous log ordering within the stream. 170 */ 171 uint64 stream_index = 3; 172 173 /* 174 * The sequence number of the first content entry in this LogEntry. 175 * 176 * Text: This is the line index of the first included line. Line indices begin 177 * at zero. 178 * Binary: This is the byte offset of the first byte in the included data. 179 * Datagram: This is the index of the datagram. The first datagram has index 180 * zero. 181 */ 182 uint64 sequence = 4; 183 184 /* 185 * The content of the message. The field that is populated here must 186 * match the log's `stream_type`. 187 */ 188 oneof content { 189 /* Text Stream: Lines of log text. */ 190 Text text = 10; 191 192 /* Binary stream: data segment. */ 193 Binary binary = 11; 194 195 /* Datagram stream: Datagrams. */ 196 Datagram datagram = 12; 197 } 198 } 199 200 /** 201 * LogIndex is an index into an at-rest log storage. 202 * 203 * The log stream and log index are generated by the Archivist during archival. 204 * 205 * An archived log stream is a series of contiguous LogEntry frames. The index 206 * maps a log's logical logation in its stream, prefix, and timeline to its 207 * frame's binary offset in the archived log stream blob. 208 */ 209 message LogIndex { 210 /* 211 * The LogStreamDescriptor for this log stream (required). 212 * 213 * The index stores the stream's LogStreamDescriptor so that a client can 214 * know the full set of log metadata by downloading its index. 215 */ 216 LogStreamDescriptor desc = 1; 217 218 /* 219 * Entry is a single index entry. 220 * 221 * The index is composed of a series of entries, each corresponding to a 222 * sequential snapshot of of the log stream. 223 */ 224 message Entry { 225 /* 226 * The byte offset in the emitted log stream of the RecordIO entry for the 227 * LogEntry corresponding to this Entry. 228 */ 229 uint64 offset = 1; 230 /* 231 * The sequence number of the first content entry. 232 * 233 * Text: This is the line index of the first included line. Line indices 234 * begin at zero. 235 * Binary: This is the byte offset of the first byte in the included data. 236 * Datagram: This is the index of the datagram. The first datagram has index 237 * zero. 238 */ 239 uint64 sequence = 2; 240 241 /* 242 * The log index that this entry describes (required). 243 * 244 * This is used by clients to identify a specific LogEntry within a set of 245 * streams sharing a Prefix. 246 */ 247 uint64 prefix_index = 3; 248 249 /* 250 * The time offset of this log entry (required). 251 * 252 * This is used by clients to identify a specific LogEntry within a log 253 * stream. 254 */ 255 uint64 stream_index = 4; 256 257 /* 258 * The time offset of this log entry, in microseconds. 259 * 260 * This is added to the descriptor's "timestamp" field to identify the 261 * specific timestamp of this log. It is used by clients to identify a 262 * specific LogEntry by time. 263 */ 264 google.protobuf.Duration time_offset = 5; 265 } 266 267 /* 268 * A series of ascending-ordered Entry messages representing snapshots of an 269 * archived log stream. 270 * 271 * Within this set of Entry messages, the "offset", "prefix_index", 272 * "stream_index", and "time_offset" fields will be ascending. 273 * 274 * The frequency of Entry messages is not defined; it is up to the Archivist 275 * process to choose a frequency. 276 */ 277 repeated Entry entries = 2; 278 279 /** 280 * The last prefix index in the log stream. 281 * 282 * This is optional. If zero, there is either no information about the last 283 * prefix index, or there are zero entries in the prefix. 284 */ 285 uint64 last_prefix_index = 3; 286 /** 287 * The last stream index in the log stream. 288 * 289 * This is optional. If zero, there is either no information about the last 290 * stream index, or there are zero entries in the stream. 291 */ 292 uint64 last_stream_index = 4; 293 /** 294 * The number of log entries in the stream. 295 * 296 * This is optional. If zero, there is either no information about the number 297 * of log entries, or there are zero entries in the stream. 298 */ 299 uint64 log_entry_count = 5; 300 }