Add ASN to logtail, collector, aggregator, frontend and CLI
This commit is contained in:
@@ -139,6 +139,7 @@ const (
|
||||
GroupBy_CLIENT_PREFIX GroupBy = 1
|
||||
GroupBy_REQUEST_URI GroupBy = 2
|
||||
GroupBy_HTTP_RESPONSE GroupBy = 3
|
||||
GroupBy_ASN_NUMBER GroupBy = 4
|
||||
)
|
||||
|
||||
// Enum value maps for GroupBy.
|
||||
@@ -148,12 +149,14 @@ var (
|
||||
1: "CLIENT_PREFIX",
|
||||
2: "REQUEST_URI",
|
||||
3: "HTTP_RESPONSE",
|
||||
4: "ASN_NUMBER",
|
||||
}
|
||||
GroupBy_value = map[string]int32{
|
||||
"WEBSITE": 0,
|
||||
"CLIENT_PREFIX": 1,
|
||||
"REQUEST_URI": 2,
|
||||
"HTTP_RESPONSE": 3,
|
||||
"ASN_NUMBER": 4,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -254,6 +257,8 @@ type Filter struct {
|
||||
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
|
||||
Tor TorFilter `protobuf:"varint,8,opt,name=tor,proto3,enum=logtail.TorFilter" json:"tor,omitempty"` // restrict to TOR / non-TOR clients
|
||||
AsnNumber *int32 `protobuf:"varint,9,opt,name=asn_number,json=asnNumber,proto3,oneof" json:"asn_number,omitempty"` // filter by client ASN
|
||||
AsnOp StatusOp `protobuf:"varint,10,opt,name=asn_op,json=asnOp,proto3,enum=logtail.StatusOp" json:"asn_op,omitempty"` // operator for asn_number; ignored when unset
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -344,6 +349,20 @@ func (x *Filter) GetTor() TorFilter {
|
||||
return TorFilter_TOR_ANY
|
||||
}
|
||||
|
||||
func (x *Filter) GetAsnNumber() int32 {
|
||||
if x != nil && x.AsnNumber != nil {
|
||||
return *x.AsnNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Filter) GetAsnOp() StatusOp {
|
||||
if x != nil {
|
||||
return x.AsnOp
|
||||
}
|
||||
return StatusOp_EQ
|
||||
}
|
||||
|
||||
type TopNRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Filter *Filter `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||
@@ -904,7 +923,7 @@ var File_proto_logtail_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_proto_logtail_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x13proto/logtail.proto\x12\alogtail\"\xb1\x03\n" +
|
||||
"\x13proto/logtail.proto\x12\alogtail\"\x8e\x04\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" +
|
||||
@@ -913,7 +932,11 @@ const file_proto_logtail_proto_rawDesc = "" +
|
||||
"\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\x01\x12$\n" +
|
||||
"\x03tor\x18\b \x01(\x0e2\x12.logtail.TorFilterR\x03torB\n" +
|
||||
"\x03tor\x18\b \x01(\x0e2\x12.logtail.TorFilterR\x03tor\x12\"\n" +
|
||||
"\n" +
|
||||
"asn_number\x18\t \x01(\x05H\x06R\tasnNumber\x88\x01\x01\x12(\n" +
|
||||
"\x06asn_op\x18\n" +
|
||||
" \x01(\x0e2\x11.logtail.StatusOpR\x05asnOpB\n" +
|
||||
"\n" +
|
||||
"\b_websiteB\x10\n" +
|
||||
"\x0e_client_prefixB\x13\n" +
|
||||
@@ -921,7 +944,8 @@ const file_proto_logtail_proto_rawDesc = "" +
|
||||
"\x0e_http_responseB\x10\n" +
|
||||
"\x0e_website_regexB\f\n" +
|
||||
"\n" +
|
||||
"_uri_regex\"\x9a\x01\n" +
|
||||
"_uri_regexB\r\n" +
|
||||
"\v_asn_number\"\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" +
|
||||
@@ -966,12 +990,14 @@ const file_proto_logtail_proto_rawDesc = "" +
|
||||
"\x02GT\x10\x02\x12\x06\n" +
|
||||
"\x02GE\x10\x03\x12\x06\n" +
|
||||
"\x02LT\x10\x04\x12\x06\n" +
|
||||
"\x02LE\x10\x05*M\n" +
|
||||
"\x02LE\x10\x05*]\n" +
|
||||
"\aGroupBy\x12\v\n" +
|
||||
"\aWEBSITE\x10\x00\x12\x11\n" +
|
||||
"\rCLIENT_PREFIX\x10\x01\x12\x0f\n" +
|
||||
"\vREQUEST_URI\x10\x02\x12\x11\n" +
|
||||
"\rHTTP_RESPONSE\x10\x03*A\n" +
|
||||
"\rHTTP_RESPONSE\x10\x03\x12\x0e\n" +
|
||||
"\n" +
|
||||
"ASN_NUMBER\x10\x04*A\n" +
|
||||
"\x06Window\x12\a\n" +
|
||||
"\x03W1M\x10\x00\x12\a\n" +
|
||||
"\x03W5M\x10\x01\x12\b\n" +
|
||||
@@ -1020,28 +1046,29 @@ var file_proto_logtail_proto_goTypes = []any{
|
||||
var file_proto_logtail_proto_depIdxs = []int32{
|
||||
1, // 0: logtail.Filter.status_op:type_name -> logtail.StatusOp
|
||||
0, // 1: logtail.Filter.tor:type_name -> logtail.TorFilter
|
||||
4, // 2: logtail.TopNRequest.filter:type_name -> logtail.Filter
|
||||
2, // 3: logtail.TopNRequest.group_by:type_name -> logtail.GroupBy
|
||||
3, // 4: logtail.TopNRequest.window:type_name -> logtail.Window
|
||||
6, // 5: logtail.TopNResponse.entries:type_name -> logtail.TopNEntry
|
||||
4, // 6: logtail.TrendRequest.filter:type_name -> logtail.Filter
|
||||
3, // 7: logtail.TrendRequest.window:type_name -> logtail.Window
|
||||
9, // 8: logtail.TrendResponse.points:type_name -> logtail.TrendPoint
|
||||
6, // 9: logtail.Snapshot.entries:type_name -> logtail.TopNEntry
|
||||
14, // 10: logtail.ListTargetsResponse.targets:type_name -> logtail.TargetInfo
|
||||
5, // 11: logtail.LogtailService.TopN:input_type -> logtail.TopNRequest
|
||||
8, // 12: logtail.LogtailService.Trend:input_type -> logtail.TrendRequest
|
||||
11, // 13: logtail.LogtailService.StreamSnapshots:input_type -> logtail.SnapshotRequest
|
||||
13, // 14: logtail.LogtailService.ListTargets:input_type -> logtail.ListTargetsRequest
|
||||
7, // 15: logtail.LogtailService.TopN:output_type -> logtail.TopNResponse
|
||||
10, // 16: logtail.LogtailService.Trend:output_type -> logtail.TrendResponse
|
||||
12, // 17: logtail.LogtailService.StreamSnapshots:output_type -> logtail.Snapshot
|
||||
15, // 18: logtail.LogtailService.ListTargets:output_type -> logtail.ListTargetsResponse
|
||||
15, // [15:19] is the sub-list for method output_type
|
||||
11, // [11:15] is the sub-list for method input_type
|
||||
11, // [11:11] is the sub-list for extension type_name
|
||||
11, // [11:11] is the sub-list for extension extendee
|
||||
0, // [0:11] is the sub-list for field type_name
|
||||
1, // 2: logtail.Filter.asn_op:type_name -> logtail.StatusOp
|
||||
4, // 3: logtail.TopNRequest.filter:type_name -> logtail.Filter
|
||||
2, // 4: logtail.TopNRequest.group_by:type_name -> logtail.GroupBy
|
||||
3, // 5: logtail.TopNRequest.window:type_name -> logtail.Window
|
||||
6, // 6: logtail.TopNResponse.entries:type_name -> logtail.TopNEntry
|
||||
4, // 7: logtail.TrendRequest.filter:type_name -> logtail.Filter
|
||||
3, // 8: logtail.TrendRequest.window:type_name -> logtail.Window
|
||||
9, // 9: logtail.TrendResponse.points:type_name -> logtail.TrendPoint
|
||||
6, // 10: logtail.Snapshot.entries:type_name -> logtail.TopNEntry
|
||||
14, // 11: logtail.ListTargetsResponse.targets:type_name -> logtail.TargetInfo
|
||||
5, // 12: logtail.LogtailService.TopN:input_type -> logtail.TopNRequest
|
||||
8, // 13: logtail.LogtailService.Trend:input_type -> logtail.TrendRequest
|
||||
11, // 14: logtail.LogtailService.StreamSnapshots:input_type -> logtail.SnapshotRequest
|
||||
13, // 15: logtail.LogtailService.ListTargets:input_type -> logtail.ListTargetsRequest
|
||||
7, // 16: logtail.LogtailService.TopN:output_type -> logtail.TopNResponse
|
||||
10, // 17: logtail.LogtailService.Trend:output_type -> logtail.TrendResponse
|
||||
12, // 18: logtail.LogtailService.StreamSnapshots:output_type -> logtail.Snapshot
|
||||
15, // 19: logtail.LogtailService.ListTargets:output_type -> logtail.ListTargetsResponse
|
||||
16, // [16:20] is the sub-list for method output_type
|
||||
12, // [12:16] is the sub-list for method input_type
|
||||
12, // [12:12] is the sub-list for extension type_name
|
||||
12, // [12:12] is the sub-list for extension extendee
|
||||
0, // [0:12] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_logtail_proto_init() }
|
||||
|
||||
Reference in New Issue
Block a user