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/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 ) 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 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..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 @@ -56,9 +56,9 @@ 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("logType").field("type", "keyword").endObject() .startObject("message").field("type", "text") - .field("analyzer", "standard") + .field("index", false) .endObject() .endObject() .endObject()