日志文件存储.

This commit is contained in:
lijiahang
2024-03-12 10:58:20 +08:00
parent 5349237fb3
commit 779a84ae25
14 changed files with 149 additions and 33 deletions

View File

@@ -27,7 +27,6 @@ public class ExecRequest extends PageRequest {
@Schema(description = "执行模板id")
private Long templateId;
@NotBlank
@Size(max = 128)
@Schema(description = "执行描述")
private String desc;

View File

@@ -9,6 +9,7 @@ import com.orion.lang.utils.json.matcher.NoMatchStrategy;
import com.orion.lang.utils.json.matcher.ReplacementFormatter;
import com.orion.lang.utils.json.matcher.ReplacementFormatters;
import com.orion.lang.utils.time.Dates;
import com.orion.ops.framework.common.constant.Const;
import com.orion.ops.framework.common.constant.ErrorMessage;
import com.orion.ops.framework.common.security.LoginUser;
import com.orion.ops.framework.common.utils.Valid;
@@ -81,7 +82,7 @@ public class ExecServiceImpl implements ExecService {
ExecLogDO execLog = ExecLogDO.builder()
.userId(userId)
.source(ExecSourceEnum.BATCH.name())
.desc(request.getDesc())
.desc(Strings.ifBlank(request.getDesc(), Strings.retain(command, 60) + Const.OMIT))
.command(command)
.status(ExecStatusEnum.COMPLETED.name())
.build();
@@ -124,7 +125,7 @@ public class ExecServiceImpl implements ExecService {
* @return logPath
*/
private String buildLogPath(Long logId, Long hostId) {
return "/logs/exec/" + logId + "/" + hostId + ".log";
return "/exec/" + logId + "/" + hostId + ".log";
}
/**