From aabb0930ba15b755af0597f3a1c72e22cac4b860 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 9 Nov 2022 11:58:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=97=A5=E5=BF=97=E6=90=9C?= =?UTF-8?q?=E7=B4=A2method:XXX=E5=92=8CrequestMethod:XXX=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/http_access_log_dao.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/db/models/http_access_log_dao.go b/internal/db/models/http_access_log_dao.go index c04f9618..739b004c 100644 --- a/internal/db/models/http_access_log_dao.go +++ b/internal/db/models/http_access_log_dao.go @@ -460,6 +460,7 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx, var requestPathReg = regexp.MustCompile(`requestPath:(\S+)`) var protoReg = regexp.MustCompile(`proto:(\S+)`) var schemeReg = regexp.MustCompile(`scheme:(\S+)`) + var methodReg = regexp.MustCompile(`(?:method|requestMethod):(\S+)`) var count = len(tableQueries) var wg = &sync.WaitGroup{} @@ -607,6 +608,11 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx, query.Where("JSON_EXTRACT(content, '$.requestURI') LIKE :keyword"). Param("keyword", dbutils.QuoteLikePrefix("\""+u.RequestURI())) } + } else if methodReg.MatchString(keyword) { // method|requestMethod:xxx + isSpecialKeyword = true + var matches = methodReg.FindStringSubmatch(keyword) + query.Where("JSON_EXTRACT(content, '$.requestMethod')=:keyword"). + Param("keyword", strings.ToUpper(matches[1])) } if !isSpecialKeyword { if regexp.MustCompile(`^ip:.+`).MatchString(keyword) {