Spring Cloud Data Flow Java DSL:获取流组件的日志

问题描述

我正在使用通过docker-compose在本地部署的SCDF 2.5.1,我的软件通过java DSL将命令发送到SCDF服务器。

假设我创建了这样的流

file > :queue
:queue > ftp

其中fileftp是docker部署的应用程序。

我的问题是,如何获取fileftp的日志?

到目前为止,我想出的最接近的东西是

Map<String,String> attributes = scdf.runtimeOperations().streamStatus(streamName).getContent()
                .stream().flatMap(stream -> stream.getApplications().getContent().stream()
                        .filter(app -> app.getName().equals(appName))
                        .flatMap(appStatus -> appStatus.getInstances().getContent().stream()
                                .map(AppInstanceStatusResource::getAttributes)))
                .findFirst().orElse(Collections.emptyMap());

String logLocation = attributes.get("stdout")

然后挂载logLocation并将其读取为文件

有没有更优雅的解决方案?

解决方法

作为REST操作的一部分,Java DSL(以及随后的SCDF REST客户端)没有log检索操作。您可以通过REST endpoint到SCDF服务器上获取流的日志。

如果您想贡献,可以在这里提交提案/ PR:https://github.com/spring-cloud/spring-cloud-dataflow/pulls