From f37600549fd75efd4903d8dafe57e904f1f8ea57 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Wed, 8 Jan 2025 16:11:46 +0800 Subject: [PATCH 1/5] =?UTF-8?q?pref:=20=E6=97=A5=E5=BF=97=E6=A8=A1?= =?UTF-8?q?=E5=9D=97ES=E5=AD=98=E5=82=A8=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#7091=20=E5=8F=96=E6=B6=88message=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt index 970eb05d63f..4f9dbcb5e51 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt @@ -58,7 +58,7 @@ object ESIndexUtils { .startObject("executeCount").field("type", "keyword").endObject() .startObject("logType").field("type", "text").endObject() .startObject("message").field("type", "text") - .field("analyzer", "standard") + .field("index", false) .endObject() .endObject() .endObject() From 481d81c964f8d78274af09d46b6b115c7acbc685 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Thu, 9 Jan 2025 12:09:09 +0800 Subject: [PATCH 2/5] =?UTF-8?q?pref:=20=E6=97=A5=E5=BF=97=E6=A8=A1?= =?UTF-8?q?=E5=9D=97ES=E5=AD=98=E5=82=A8=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#7091=20=E5=8F=96=E6=B6=88=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/log/api/print/ServiceLogPrintResource.kt | 2 +- .../com/tencent/devops/log/dao/LogStatusDao.kt | 13 +++++++------ .../com/tencent/devops/log/event/LogStatusEvent.kt | 2 +- .../tencent/devops/log/service/LogStatusService.kt | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/ServiceLogPrintResource.kt b/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/ServiceLogPrintResource.kt index d0332cd1afa..28f4142d9df 100644 --- a/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/ServiceLogPrintResource.kt +++ b/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/ServiceLogPrintResource.kt @@ -127,7 +127,7 @@ interface ServiceLogPrintResource { executeCount: Int?, @Parameter(description = "插件的存储模式", required = false) @QueryParam("logStorageMode") - logStorageMode: LogStorageMode? = LogStorageMode.UPLOAD, + logStorageMode: LogStorageMode? = null, @Parameter(description = "job id", required = false) @QueryParam("userJobId") jobId: String?, diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/dao/LogStatusDao.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/dao/LogStatusDao.kt index b9e7835141b..e6c94a198d2 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/dao/LogStatusDao.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/dao/LogStatusDao.kt @@ -46,26 +46,27 @@ class LogStatusDao { subTags: String?, containerHashId: String?, executeCount: Int, - logStorageMode: LogStorageMode, + logStorageMode: LogStorageMode?, finish: Boolean, jobId: String?, stepId: String? ) { with(TLogStatus.T_LOG_STATUS) { - dslContext.insertInto(this) + val update = dslContext.insertInto(this) .set(BUILD_ID, buildId) .set(TAG, tag) .set(SUB_TAG, subTags) .set(EXECUTE_COUNT, executeCount) .set(JOB_ID, containerHashId) .set(FINISHED, finish) - .set(MODE, logStorageMode.name) + .set(USER_JOB_ID, jobId) .set(STEP_ID, stepId) - .onDuplicateKeyUpdate() + logStorageMode?.let { update.set(MODE, it.name) } + update.onDuplicateKeyUpdate() .set(FINISHED, finish) - .set(MODE, logStorageMode.name) - .execute() + logStorageMode?.let { update.set(MODE, it.name) } + update.execute() } } diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/event/LogStatusEvent.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/event/LogStatusEvent.kt index 17e56c21fd3..3b0e6e63e6a 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/event/LogStatusEvent.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/event/LogStatusEvent.kt @@ -44,7 +44,7 @@ data class LogStatusEvent( val userJobId: String?, val stepId: String?, val executeCount: Int?, - val logStorageMode: LogStorageMode? = LogStorageMode.UPLOAD, + val logStorageMode: LogStorageMode?, override var retryTime: Int = 2, override var delayMills: Int = 0 ) : ILogEvent(buildId, retryTime, delayMills) diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/service/LogStatusService.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/service/LogStatusService.kt index a7db4c0466f..db2e6098ef9 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/service/LogStatusService.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/service/LogStatusService.kt @@ -63,7 +63,7 @@ class LogStatusService @Autowired constructor( subTags = subTag ?: "", containerHashId = containerHashId ?: "", executeCount = executeCount ?: 1, - logStorageMode = logStorageMode ?: LogStorageMode.UPLOAD, + logStorageMode = logStorageMode, finish = finish, jobId = jobId, stepId = stepId From 1f897c8c6b81d237bfaf161504fabce629aa8f89 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Thu, 9 Jan 2025 12:18:20 +0800 Subject: [PATCH 3/5] =?UTF-8?q?pref:=20=E6=97=A5=E5=BF=97=E6=A8=A1?= =?UTF-8?q?=E5=9D=97ES=E5=AD=98=E5=82=A8=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#7091=20=E4=BF=AE=E6=94=B9=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E7=9A=84=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt index 4f9dbcb5e51..fe731c4f82b 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt @@ -56,8 +56,8 @@ object ESIndexUtils { .startObject("containerHashId").field("type", "keyword").endObject() .startObject("stepId").field("type", "keyword").endObject() .startObject("executeCount").field("type", "keyword").endObject() - .startObject("logType").field("type", "text").endObject() - .startObject("message").field("type", "text") + .startObject("logType").field("type", "keyword").endObject() + .startObject("message").field("type", "keyword") .field("index", false) .endObject() .endObject() From ee7ffaa7ee0d08ae989b6914e420a9d055554c6f Mon Sep 17 00:00:00 2001 From: royalhuang Date: Fri, 10 Jan 2025 10:26:44 +0800 Subject: [PATCH 4/5] =?UTF-8?q?pref:=20=E6=97=A5=E5=BF=97=E6=A8=A1?= =?UTF-8?q?=E5=9D=97ES=E5=AD=98=E5=82=A8=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#7091=20=E4=BF=AE=E6=94=B9=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E7=9A=84=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt index fe731c4f82b..2079606606a 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/util/ESIndexUtils.kt @@ -57,7 +57,7 @@ object ESIndexUtils { .startObject("stepId").field("type", "keyword").endObject() .startObject("executeCount").field("type", "keyword").endObject() .startObject("logType").field("type", "keyword").endObject() - .startObject("message").field("type", "keyword") + .startObject("message").field("type", "text") .field("index", false) .endObject() .endObject() From 664ccebf58ac72a42bed8b3db6fb8de14ff441a7 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Fri, 10 Jan 2025 11:12:03 +0800 Subject: [PATCH 5/5] =?UTF-8?q?pref:=20=E6=97=A5=E5=BF=97=E6=A8=A1?= =?UTF-8?q?=E5=9D=97ES=E5=AD=98=E5=82=A8=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#7091=20=E4=BF=AE=E6=94=B9=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E7=9A=84=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/log/resources/ServiceLogPrintResourceImpl.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/resources/ServiceLogPrintResourceImpl.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/resources/ServiceLogPrintResourceImpl.kt index f03fc6dda1d..25a06feeea4 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/resources/ServiceLogPrintResourceImpl.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/resources/ServiceLogPrintResourceImpl.kt @@ -86,6 +86,7 @@ class ServiceLogPrintResourceImpl @Autowired constructor( subTag = subTag, jobId = containerHashId, executeCount = executeCount, + logStorageMode = null, userJobId = jobId, stepId = stepId )