1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
|
syntax = "proto3";
package types.v1;
import "google/protobuf/timestamp.proto";
import "types/v1/types.proto";
option go_package = "types/v1;typesv1";
message LogQuery {
Timerange timerange = 1;
Context context = 2;
Statements query = 3;
}
message Timerange {
Expr from = 1;
optional Expr to = 2;
}
message Context {
optional Expr machine_id = 101;
optional Expr session_id = 102;
}
message Statements {
// statements are `|` separated
repeated Statement statements = 1;
RenderStatement render = 2;
}
message Statement {
oneof stmt {
FilterOperator filter = 1;
SummarizeOperator summarize = 2;
ProjectOperator project = 300;
ProjectAwayOperator project_away = 301;
ProjectKeepOperator project_keep = 302;
ExtendOperator extend = 4;
CountOperator count = 5;
DistinctOperator distinct = 6;
SampleOperator sample = 7;
SearchOperator search = 8;
SortOperator sort = 9;
TakeOperator take = 10;
TopOperator top = 11;
}
}
message FilterOperator {
Expr expr = 1;
}
message SummarizeOperator {
message Parameters {
repeated Parameter parameters = 1;
}
message Parameter {
optional Identifier column = 1;
FuncCall aggregate_function = 2;
}
message ByGroupExpressions {
repeated ByGroupExpression groups = 2;
}
message ByGroupExpression {
optional Identifier column = 1;
Expr scalar = 2;
}
Parameters parameters = 1;
optional ByGroupExpressions by_group_expressions = 2;
}
message ProjectOperator {
message Projection {
Identifier column = 1;
optional Expr value = 2;
}
repeated Projection projections = 1;
}
message ProjectAwayOperator {
message Projection {
Identifier column = 1;
}
repeated Projection projections = 1;
}
message ProjectKeepOperator {
message Projection {
Identifier column = 1;
}
repeated Projection projections = 1;
}
message ExtendOperator {
message Projection {
Identifier column = 1;
Expr value = 2;
}
repeated Projection projections = 1;
}
message CountOperator {}
message DistinctOperator {
repeated Identifier fields = 1;
}
message SampleOperator {
int64 count = 1;
}
message SearchOperator {
enum Kind {
Default = 0;
CaseInsensitive = 1;
CaseSensitive = 2;
}
message Literal {
string literal = 1;
}
message FieldSearch {
string column = 1;
string literal = 2;
}
message ExactSearch {
string column = 1;
string literal = 2;
}
message RegexSearch {
string column = 1;
string regex = 2;
}
oneof predicate {
string literal = 101;
FieldSearch field = 102;
ExactSearch exact = 103;
RegexSearch regex = 104;
}
optional Kind kind = 2;
}
message SortOperator {
enum Order {
Desc = 0;
Asc = 1;
}
message ByColumn {
Identifier column = 1;
optional Order order = 2;
}
repeated ByColumn by_columns = 1;
}
message TakeOperator {
int64 count = 1;
}
message TopOperator {
enum Order {
Desc = 0;
Asc = 1;
}
message ByColumn {
Expr scalar = 1;
optional Order order = 2;
}
int64 count = 1;
optional ByColumn by_column = 2;
}
message RenderStatement {
oneof stmt {
SplitOperator split = 1;
}
}
message SplitOperator {
message ByOperator {
repeated Expr scalars = 1;
}
ByOperator by = 2;
}
message Expr {
oneof expr {
Val literal = 101;
UnaryOp unary = 102;
BinaryOp binary = 103;
FuncCall func_call = 104;
Identifier identifier = 105;
Indexor indexor = 106; // kvs['hello']
}
}
message UnaryOp {
enum Operator {
INVALID = 0;
NOT = 1;
NEG = 2;
}
Operator op = 1;
Expr arg = 2;
}
message BinaryOp {
enum Operator {
INVALID = 0;
LOG_AND = 101;
LOG_OR = 102;
NUM_ADD = 201;
NUM_SUB = 202;
NUM_DIV = 203;
NUM_MUL = 204;
NUM_MOD = 205;
CMP_EQ = 301;
CMP_NOTEQ = 302;
CMP_GT = 303;
CMP_GTE = 304;
CMP_LT = 305;
CMP_LTE = 306;
SET_IN = 401;
SET_NOTIN = 402;
STR_EQ_NOCS = 501;
STR_NOTEQ_NOCS = 502;
STR_CONTAINS = 503;
STR_NOT_CONTAINS = 504;
STR_CONTAINS_CS = 505;
STR_NOT_CONTAINS_CS = 506;
STR_STARTSWITH = 507;
STR_NOT_STARTSWITH = 508;
STR_STARTSWITH_CS = 509;
STR_NOT_STARTSWITH_CS = 510;
STR_ENDSWITH = 511;
STR_NOT_ENDSWITH = 512;
STR_ENDSWITH_CS = 513;
STR_NOT_ENDSWITH_CS = 514;
STR_IN_NOCS = 515;
STR_NOT_IN_NOCS = 516;
STR_NOT_MATCHES_REGEX = 517;
STR_MATCHES_REGEX = 518;
STR_HAS = 519;
STR_HAS_CS = 520;
STR_HASSUFFIX = 521;
STR_HASSUFFIX_CS = 522;
STR_HASPREFIX = 523;
STR_HASPREFIX_CS = 524;
}
Expr lhs = 1;
Operator op = 2;
Expr rhs = 3;
}
message FuncCall {
string name = 1;
repeated Expr args = 2;
}
message Identifier {
string name = 1;
}
message Indexor {
Expr x = 1;
Expr index = 2;
}
|