I'm scripting a deploy to cloud foundry using the CF CLI, and would like to capture the logs related to the new application being started up for analysis. This requires two different commands typically, cf push [appname] -f [manifest.yml]
and cf logs [appname] > [appname].log
. The problem is that until mid-way though the push command, the application will not exist yet, and cf logs
requires an existing application in order to run successfully.
I think my script would have read the output stream from cf push
to look for the line stating that the service has been created, then fire off a cf logs
command in a second thread to capture those logs. I'm looking for a mechanism by which I could inspect the output of cf push
and trigger that second process.
Two questions
- Is this even possible?
- What would this kind of thing even be called so I can find some documentation on a sound approach?
cf push ...etc.. | grep "service has been created" && cf logs ... etc ..
? – Jeff Schaller Apr 19 '16 at 15:25--no-start
argument tocf push
, which prevents the application from starting after it's deployed, this gives me a chance to fire off thecf logs
process in the background before callingcf start
to capture the whole startup process, but I would be interested in the answer to the original question. – tom.dietrich Apr 19 '16 at 16:10