@SneakyThrows
    @Get("/debugging/query/log/queryLogs")
    public String queryLogs(@Param("service") Optional<String> service,
                            @Param("serviceLayer") Optional<String> serviceLayer,
                            @Param("serviceInstance") Optional<String> serviceInstance,
                            @Param("endpoint") Optional<String> endpoint,
                            @Param("startTime") Optional<String> startTime,
                            @Param("endTime") Optional<String> endTime,
                            @Param("step") Optional<String> step,
                            @Param("coldStage") Optional<Boolean> coldStage,
                            @Param("traceId") Optional<String> traceId,
                            @Param("segmentId") Optional<String> segmentId,
                            @Param("spanId") Optional<Integer> spanId,
                            @Param("tags") Optional<String> tags,
                            @Param("pageNum") int pageNum,
                            @Param("pageSize") int pageSize,
                            @Param("keywordsOfContent") Optional<String> keywordsOfContent,
                            @Param("excludingKeywordsOfContent") Optional<String> excludingKeywordsOfContent,
                            @Param("queryOrder") Optional<String> queryOrder) {
        LogQueryCondition condition = new LogQueryCondition();
        condition.setPaging(new Pagination(pageNum, pageSize));
        if (traceId.isPresent()) {
            TraceScopeCondition traceScopeCondition = new TraceScopeCondition();
            traceScopeCondition.setTraceId(traceId.get());
            segmentId.ifPresent(traceScopeCondition::setSegmentId);
            spanId.ifPresent(traceScopeCondition::setSpanId);
            condition.setRelatedTrace(traceScopeCondition);
        } else {
            if (startTime.isEmpty() || endTime.isEmpty() || step.isEmpty()) {
                return "startTime, endTime and step are required";
            }
            Duration duration = new Duration();
            duration.setStart(startTime.get());
            duration.setEnd(endTime.get());
            duration.setStep(Step.valueOf(step.get()));
            coldStage.ifPresent(duration::setColdStage);
            condition.setQueryDuration(duration);
        }

        Optional<String> serviceId = service.map(
            name -> IDManager.ServiceID.buildId(name, Layer.nameOf(serviceLayer.orElseThrow()).isNormal()));
        Optional<String> serviceInstanceId = serviceInstance.map(
            name -> IDManager.ServiceInstanceID.buildId(serviceId.orElseThrow(), name));
        Optional<String> endpointId = endpoint.map(name -> IDManager.EndpointID.buildId(serviceId.orElseThrow(), name));
        serviceId.ifPresent(condition::setServiceId);
        serviceInstanceId.ifPresent(condition::setServiceInstanceId);
        endpointId.ifPresent(condition::setEndpointId);
        tags.ifPresent(ts -> {
            List<Tag> tagList = new ArrayList<>();
            Arrays.stream(ts.split(Const.COMMA)).forEach(t -> {
                Tag tag = new Tag();
                String[] tagArr = t.split(Const.EQUAL);
                tag.setKey(tagArr[0]);
                tag.setValue(tagArr[1]);
                tagList.add(tag);
            });
            condition.setTags(tagList);
        });
        queryOrder.ifPresent(s -> condition.setQueryOrder(Order.valueOf(s)));
        keywordsOfContent.ifPresent(
            k -> condition.setKeywordsOfContent(Arrays.stream(k.split(Const.COMMA)).collect(Collectors.toList())));
        excludingKeywordsOfContent.ifPresent(e -> condition.setExcludingKeywordsOfContent(
            Arrays.stream(e.split(Const.COMMA)).collect(Collectors.toList())));

        Logs logs = logQuery.queryLogs(condition, true).join();
        DebuggingQueryLogsRsp result = new DebuggingQueryLogsRsp(
            logs.getLogs(), logs.getErrorReason(), transformTrace(logs.getDebuggingTrace()));
        return transToYAMLString(result);
    }
Only for BanyanDB, can be used to query the trace in the cold stage.
oap-server/server-query-plugin/status-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingHTTPHandler.java