Implement filter in status, website and uri in CLI and Frontend
This commit is contained in:
@@ -4,13 +4,27 @@ package logtail;
|
||||
|
||||
option go_package = "git.ipng.ch/ipng/nginx-logtail/proto/logtailpb";
|
||||
|
||||
// StatusOp is the comparison operator applied to http_response in a Filter.
|
||||
// Defaults to EQ (exact match) for backward compatibility.
|
||||
enum StatusOp {
|
||||
EQ = 0; // ==
|
||||
NE = 1; // !=
|
||||
GT = 2; // >
|
||||
GE = 3; // >=
|
||||
LT = 4; // <
|
||||
LE = 5; // <=
|
||||
}
|
||||
|
||||
// Filter restricts results to entries matching all specified fields.
|
||||
// Unset fields match everything.
|
||||
// Unset fields match everything. Exact-match and regex fields are ANDed.
|
||||
message Filter {
|
||||
optional string website = 1;
|
||||
optional string client_prefix = 2;
|
||||
optional string http_request_uri = 3;
|
||||
optional int32 http_response = 4;
|
||||
optional string website = 1;
|
||||
optional string client_prefix = 2;
|
||||
optional string http_request_uri = 3;
|
||||
optional int32 http_response = 4;
|
||||
StatusOp status_op = 5; // operator for http_response; ignored when unset
|
||||
optional string website_regex = 6; // RE2 regex matched against website
|
||||
optional string uri_regex = 7; // RE2 regex matched against http_request_uri
|
||||
}
|
||||
|
||||
enum GroupBy {
|
||||
|
||||
@@ -21,6 +21,66 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// StatusOp is the comparison operator applied to http_response in a Filter.
|
||||
// Defaults to EQ (exact match) for backward compatibility.
|
||||
type StatusOp int32
|
||||
|
||||
const (
|
||||
StatusOp_EQ StatusOp = 0 // ==
|
||||
StatusOp_NE StatusOp = 1 // !=
|
||||
StatusOp_GT StatusOp = 2 // >
|
||||
StatusOp_GE StatusOp = 3 // >=
|
||||
StatusOp_LT StatusOp = 4 // <
|
||||
StatusOp_LE StatusOp = 5 // <=
|
||||
)
|
||||
|
||||
// Enum value maps for StatusOp.
|
||||
var (
|
||||
StatusOp_name = map[int32]string{
|
||||
0: "EQ",
|
||||
1: "NE",
|
||||
2: "GT",
|
||||
3: "GE",
|
||||
4: "LT",
|
||||
5: "LE",
|
||||
}
|
||||
StatusOp_value = map[string]int32{
|
||||
"EQ": 0,
|
||||
"NE": 1,
|
||||
"GT": 2,
|
||||
"GE": 3,
|
||||
"LT": 4,
|
||||
"LE": 5,
|
||||
}
|
||||
)
|
||||
|
||||
func (x StatusOp) Enum() *StatusOp {
|
||||
p := new(StatusOp)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x StatusOp) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (StatusOp) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_logtail_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (StatusOp) Type() protoreflect.EnumType {
|
||||
return &file_logtail_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x StatusOp) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StatusOp.Descriptor instead.
|
||||
func (StatusOp) EnumDescriptor() ([]byte, []int) {
|
||||
return file_logtail_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type GroupBy int32
|
||||
|
||||
const (
|
||||
@@ -57,11 +117,11 @@ func (x GroupBy) String() string {
|
||||
}
|
||||
|
||||
func (GroupBy) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_logtail_proto_enumTypes[0].Descriptor()
|
||||
return file_logtail_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (GroupBy) Type() protoreflect.EnumType {
|
||||
return &file_logtail_proto_enumTypes[0]
|
||||
return &file_logtail_proto_enumTypes[1]
|
||||
}
|
||||
|
||||
func (x GroupBy) Number() protoreflect.EnumNumber {
|
||||
@@ -70,7 +130,7 @@ func (x GroupBy) Number() protoreflect.EnumNumber {
|
||||
|
||||
// Deprecated: Use GroupBy.Descriptor instead.
|
||||
func (GroupBy) EnumDescriptor() ([]byte, []int) {
|
||||
return file_logtail_proto_rawDescGZIP(), []int{0}
|
||||
return file_logtail_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
type Window int32
|
||||
@@ -115,11 +175,11 @@ func (x Window) String() string {
|
||||
}
|
||||
|
||||
func (Window) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_logtail_proto_enumTypes[1].Descriptor()
|
||||
return file_logtail_proto_enumTypes[2].Descriptor()
|
||||
}
|
||||
|
||||
func (Window) Type() protoreflect.EnumType {
|
||||
return &file_logtail_proto_enumTypes[1]
|
||||
return &file_logtail_proto_enumTypes[2]
|
||||
}
|
||||
|
||||
func (x Window) Number() protoreflect.EnumNumber {
|
||||
@@ -128,17 +188,20 @@ func (x Window) Number() protoreflect.EnumNumber {
|
||||
|
||||
// Deprecated: Use Window.Descriptor instead.
|
||||
func (Window) EnumDescriptor() ([]byte, []int) {
|
||||
return file_logtail_proto_rawDescGZIP(), []int{1}
|
||||
return file_logtail_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
// Filter restricts results to entries matching all specified fields.
|
||||
// Unset fields match everything.
|
||||
// Unset fields match everything. Exact-match and regex fields are ANDed.
|
||||
type Filter struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Website *string `protobuf:"bytes,1,opt,name=website,proto3,oneof" json:"website,omitempty"`
|
||||
ClientPrefix *string `protobuf:"bytes,2,opt,name=client_prefix,json=clientPrefix,proto3,oneof" json:"client_prefix,omitempty"`
|
||||
HttpRequestUri *string `protobuf:"bytes,3,opt,name=http_request_uri,json=httpRequestUri,proto3,oneof" json:"http_request_uri,omitempty"`
|
||||
HttpResponse *int32 `protobuf:"varint,4,opt,name=http_response,json=httpResponse,proto3,oneof" json:"http_response,omitempty"`
|
||||
StatusOp StatusOp `protobuf:"varint,5,opt,name=status_op,json=statusOp,proto3,enum=logtail.StatusOp" json:"status_op,omitempty"` // operator for http_response; ignored when unset
|
||||
WebsiteRegex *string `protobuf:"bytes,6,opt,name=website_regex,json=websiteRegex,proto3,oneof" json:"website_regex,omitempty"` // RE2 regex matched against website
|
||||
UriRegex *string `protobuf:"bytes,7,opt,name=uri_regex,json=uriRegex,proto3,oneof" json:"uri_regex,omitempty"` // RE2 regex matched against http_request_uri
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -201,6 +264,27 @@ func (x *Filter) GetHttpResponse() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Filter) GetStatusOp() StatusOp {
|
||||
if x != nil {
|
||||
return x.StatusOp
|
||||
}
|
||||
return StatusOp_EQ
|
||||
}
|
||||
|
||||
func (x *Filter) GetWebsiteRegex() string {
|
||||
if x != nil && x.WebsiteRegex != nil {
|
||||
return *x.WebsiteRegex
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Filter) GetUriRegex() string {
|
||||
if x != nil && x.UriRegex != nil {
|
||||
return *x.UriRegex
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type TopNRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Filter *Filter `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||
@@ -629,17 +713,23 @@ var File_logtail_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_logtail_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\rlogtail.proto\x12\alogtail\"\xef\x01\n" +
|
||||
"\rlogtail.proto\x12\alogtail\"\x8b\x03\n" +
|
||||
"\x06Filter\x12\x1d\n" +
|
||||
"\awebsite\x18\x01 \x01(\tH\x00R\awebsite\x88\x01\x01\x12(\n" +
|
||||
"\rclient_prefix\x18\x02 \x01(\tH\x01R\fclientPrefix\x88\x01\x01\x12-\n" +
|
||||
"\x10http_request_uri\x18\x03 \x01(\tH\x02R\x0ehttpRequestUri\x88\x01\x01\x12(\n" +
|
||||
"\rhttp_response\x18\x04 \x01(\x05H\x03R\fhttpResponse\x88\x01\x01B\n" +
|
||||
"\rhttp_response\x18\x04 \x01(\x05H\x03R\fhttpResponse\x88\x01\x01\x12.\n" +
|
||||
"\tstatus_op\x18\x05 \x01(\x0e2\x11.logtail.StatusOpR\bstatusOp\x12(\n" +
|
||||
"\rwebsite_regex\x18\x06 \x01(\tH\x04R\fwebsiteRegex\x88\x01\x01\x12 \n" +
|
||||
"\turi_regex\x18\a \x01(\tH\x05R\buriRegex\x88\x01\x01B\n" +
|
||||
"\n" +
|
||||
"\b_websiteB\x10\n" +
|
||||
"\x0e_client_prefixB\x13\n" +
|
||||
"\x11_http_request_uriB\x10\n" +
|
||||
"\x0e_http_response\"\x9a\x01\n" +
|
||||
"\x0e_http_responseB\x10\n" +
|
||||
"\x0e_website_regexB\f\n" +
|
||||
"\n" +
|
||||
"_uri_regex\"\x9a\x01\n" +
|
||||
"\vTopNRequest\x12'\n" +
|
||||
"\x06filter\x18\x01 \x01(\v2\x0f.logtail.FilterR\x06filter\x12+\n" +
|
||||
"\bgroup_by\x18\x02 \x01(\x0e2\x10.logtail.GroupByR\agroupBy\x12\f\n" +
|
||||
@@ -665,7 +755,14 @@ const file_logtail_proto_rawDesc = "" +
|
||||
"\bSnapshot\x12\x16\n" +
|
||||
"\x06source\x18\x01 \x01(\tR\x06source\x12\x1c\n" +
|
||||
"\ttimestamp\x18\x02 \x01(\x03R\ttimestamp\x12,\n" +
|
||||
"\aentries\x18\x03 \x03(\v2\x12.logtail.TopNEntryR\aentries*M\n" +
|
||||
"\aentries\x18\x03 \x03(\v2\x12.logtail.TopNEntryR\aentries*:\n" +
|
||||
"\bStatusOp\x12\x06\n" +
|
||||
"\x02EQ\x10\x00\x12\x06\n" +
|
||||
"\x02NE\x10\x01\x12\x06\n" +
|
||||
"\x02GT\x10\x02\x12\x06\n" +
|
||||
"\x02GE\x10\x03\x12\x06\n" +
|
||||
"\x02LT\x10\x04\x12\x06\n" +
|
||||
"\x02LE\x10\x05*M\n" +
|
||||
"\aGroupBy\x12\v\n" +
|
||||
"\aWEBSITE\x10\x00\x12\x11\n" +
|
||||
"\rCLIENT_PREFIX\x10\x01\x12\x0f\n" +
|
||||
@@ -695,41 +792,43 @@ func file_logtail_proto_rawDescGZIP() []byte {
|
||||
return file_logtail_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_logtail_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_logtail_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
||||
var file_logtail_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_logtail_proto_goTypes = []any{
|
||||
(GroupBy)(0), // 0: logtail.GroupBy
|
||||
(Window)(0), // 1: logtail.Window
|
||||
(*Filter)(nil), // 2: logtail.Filter
|
||||
(*TopNRequest)(nil), // 3: logtail.TopNRequest
|
||||
(*TopNEntry)(nil), // 4: logtail.TopNEntry
|
||||
(*TopNResponse)(nil), // 5: logtail.TopNResponse
|
||||
(*TrendRequest)(nil), // 6: logtail.TrendRequest
|
||||
(*TrendPoint)(nil), // 7: logtail.TrendPoint
|
||||
(*TrendResponse)(nil), // 8: logtail.TrendResponse
|
||||
(*SnapshotRequest)(nil), // 9: logtail.SnapshotRequest
|
||||
(*Snapshot)(nil), // 10: logtail.Snapshot
|
||||
(StatusOp)(0), // 0: logtail.StatusOp
|
||||
(GroupBy)(0), // 1: logtail.GroupBy
|
||||
(Window)(0), // 2: logtail.Window
|
||||
(*Filter)(nil), // 3: logtail.Filter
|
||||
(*TopNRequest)(nil), // 4: logtail.TopNRequest
|
||||
(*TopNEntry)(nil), // 5: logtail.TopNEntry
|
||||
(*TopNResponse)(nil), // 6: logtail.TopNResponse
|
||||
(*TrendRequest)(nil), // 7: logtail.TrendRequest
|
||||
(*TrendPoint)(nil), // 8: logtail.TrendPoint
|
||||
(*TrendResponse)(nil), // 9: logtail.TrendResponse
|
||||
(*SnapshotRequest)(nil), // 10: logtail.SnapshotRequest
|
||||
(*Snapshot)(nil), // 11: logtail.Snapshot
|
||||
}
|
||||
var file_logtail_proto_depIdxs = []int32{
|
||||
2, // 0: logtail.TopNRequest.filter:type_name -> logtail.Filter
|
||||
0, // 1: logtail.TopNRequest.group_by:type_name -> logtail.GroupBy
|
||||
1, // 2: logtail.TopNRequest.window:type_name -> logtail.Window
|
||||
4, // 3: logtail.TopNResponse.entries:type_name -> logtail.TopNEntry
|
||||
2, // 4: logtail.TrendRequest.filter:type_name -> logtail.Filter
|
||||
1, // 5: logtail.TrendRequest.window:type_name -> logtail.Window
|
||||
7, // 6: logtail.TrendResponse.points:type_name -> logtail.TrendPoint
|
||||
4, // 7: logtail.Snapshot.entries:type_name -> logtail.TopNEntry
|
||||
3, // 8: logtail.LogtailService.TopN:input_type -> logtail.TopNRequest
|
||||
6, // 9: logtail.LogtailService.Trend:input_type -> logtail.TrendRequest
|
||||
9, // 10: logtail.LogtailService.StreamSnapshots:input_type -> logtail.SnapshotRequest
|
||||
5, // 11: logtail.LogtailService.TopN:output_type -> logtail.TopNResponse
|
||||
8, // 12: logtail.LogtailService.Trend:output_type -> logtail.TrendResponse
|
||||
10, // 13: logtail.LogtailService.StreamSnapshots:output_type -> logtail.Snapshot
|
||||
11, // [11:14] is the sub-list for method output_type
|
||||
8, // [8:11] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
0, // 0: logtail.Filter.status_op:type_name -> logtail.StatusOp
|
||||
3, // 1: logtail.TopNRequest.filter:type_name -> logtail.Filter
|
||||
1, // 2: logtail.TopNRequest.group_by:type_name -> logtail.GroupBy
|
||||
2, // 3: logtail.TopNRequest.window:type_name -> logtail.Window
|
||||
5, // 4: logtail.TopNResponse.entries:type_name -> logtail.TopNEntry
|
||||
3, // 5: logtail.TrendRequest.filter:type_name -> logtail.Filter
|
||||
2, // 6: logtail.TrendRequest.window:type_name -> logtail.Window
|
||||
8, // 7: logtail.TrendResponse.points:type_name -> logtail.TrendPoint
|
||||
5, // 8: logtail.Snapshot.entries:type_name -> logtail.TopNEntry
|
||||
4, // 9: logtail.LogtailService.TopN:input_type -> logtail.TopNRequest
|
||||
7, // 10: logtail.LogtailService.Trend:input_type -> logtail.TrendRequest
|
||||
10, // 11: logtail.LogtailService.StreamSnapshots:input_type -> logtail.SnapshotRequest
|
||||
6, // 12: logtail.LogtailService.TopN:output_type -> logtail.TopNResponse
|
||||
9, // 13: logtail.LogtailService.Trend:output_type -> logtail.TrendResponse
|
||||
11, // 14: logtail.LogtailService.StreamSnapshots:output_type -> logtail.Snapshot
|
||||
12, // [12:15] is the sub-list for method output_type
|
||||
9, // [9:12] is the sub-list for method input_type
|
||||
9, // [9:9] is the sub-list for extension type_name
|
||||
9, // [9:9] is the sub-list for extension extendee
|
||||
0, // [0:9] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_logtail_proto_init() }
|
||||
@@ -743,7 +842,7 @@ func file_logtail_proto_init() {
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_logtail_proto_rawDesc), len(file_logtail_proto_rawDesc)),
|
||||
NumEnums: 2,
|
||||
NumEnums: 3,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
|
||||
Reference in New Issue
Block a user