Search code examples
spring-cloud-dataflow

Spring Cloud Data Flow java DSL: get logs for stream components


I'm using SCDF 2.5.1 deployed locally via docker-compose and my software sends commands to the SCDF server via the java DSL.

Let's say I create a stream such that

file > :queue
:queue > ftp

where file and ftp are docker deployed apps.

My question is, how can I get the logs for file and ftp?

So far the closest thing I've come up with is

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")

and then mounting logLocation and reading it as a file.

Is there a more elegant solution?


Solution

  • The Java DSL (and subsequently the SCDF REST client) doesn't have log retrieval operation as part of it's REST operations. There is an REST endpoint you can hit the SCDF server to get the logs of stream.

    If you would like to contribute, you can submit a proposal/PR here: https://github.com/spring-cloud/spring-cloud-dataflow/pulls