From 89ec81f6b13a548adc6b6cfe9a35b2e3ae6b11a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 21 Jul 2021 22:12:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A0=E6=B3=95=E5=9C=A8?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=97=A5=E5=BF=97=E4=B8=AD=E6=90=9C=E7=B4=A2?= =?UTF-8?q?IP=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/http_access_log_dao.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/db/models/http_access_log_dao.go b/internal/db/models/http_access_log_dao.go index cb3322be..6fea9f14 100644 --- a/internal/db/models/http_access_log_dao.go +++ b/internal/db/models/http_access_log_dao.go @@ -236,6 +236,10 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx, lastRequestId string, s query.Between("remoteAddr", pieces[0], pieces[1]) } } else { + if regexp.MustCompile(`^ip:.+`).MatchString(keyword) { + keyword = keyword[3:] + } + useOriginKeyword := false where := "JSON_EXTRACT(content, '$.remoteAddr') LIKE :keyword OR JSON_EXTRACT(content, '$.requestURI') LIKE :keyword OR JSON_EXTRACT(content, '$.host') LIKE :keyword"