Adds live log streaming via Log Cache — the Java equivalent of cf tail --follow.
Previously the only Log Cache read path was logsRecent, a single snapshot request. There was no way to continuously receive new log envelopes without polling manually. This change introduces a logsTail API across all three relevant modules.
Motivation
Cloud Foundry dropped the legacy Loggregator Doppler streaming endpoint (DopplerClient.stream()) in Loggregator ≥ 107.0 (CFD ≥ 24.3 / TAS ≥ 4.0). The CF CLI replaced it with a polling loop over the Log Cache /api/v1/read endpoint — that is what cf tail --follow does today. This PR brings the same capability to Java consumers.
Changes
Changes in detail
cloudfoundry-client — new TailLogsRequest and LogCacheClient.logsTail()
New _TailLogsRequest.java (Immutables @Value.Immutable):
Field
Type
Default
Description
sourceId
String
—
App / service GUID (required)
startTime
Long (nullable)
now − 5 s (ns)
Cursor start time in UNIX nanoseconds
envelopeTypes
List<EnvelopeType> (nullable)
all types
Envelope type filter
nameFilter
String (nullable)
none
Regex name filter (Log Cache ≥ 2.1.0)
pollInterval
Duration
250 ms
Back-off between polls when no new data
New method on LogCacheClient:
/** * Continuously polls Log Cache /api/v1/read and streams new Envelopes as they appear. * Equivalent to the Go logcache.Walk() API and `cf tail --follow`. * The Flux never completes on its own – cancel the subscription to stop streaming. */Flux<Envelope> logsTail(TailLogsRequestrequest);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds live log streaming via Log Cache — the Java equivalent of cf tail --follow.
Previously the only Log Cache read path was logsRecent, a single snapshot request. There was no way to continuously receive new log envelopes without polling manually. This change introduces a logsTail API across all three relevant modules.
Motivation
Cloud Foundry dropped the legacy Loggregator Doppler streaming endpoint (DopplerClient.stream()) in Loggregator ≥ 107.0 (CFD ≥ 24.3 / TAS ≥ 4.0). The CF CLI replaced it with a polling loop over the Log Cache /api/v1/read endpoint — that is what cf tail --follow does today. This PR brings the same capability to Java consumers.
Changes
Changes in detailcloudfoundry-client — new TailLogsRequest and LogCacheClient.logsTail()
New _TailLogsRequest.java (Immutables @Value.Immutable):
New method on LogCacheClient:
cloudfoundry-client-reactor — non-blocking polling implementation
ReactorLogCacheEndpoints.logsTail() mirrors the Go logcache.Walk() algorithm, fully non-blocking:
Transient network errors are logged and retried. HTTP errors (4xx/5xx) are propagated to the subscriber.
cloudfoundry-operations — Applications.logsTail()
DefaultApplications delegates to LogCacheClient:
Tests
Usage
Or via the Operations API:
Relation to existing API
Checklist