How can I get the output of Cloudfoudry CLI vmc/cf by "grep"

1k views Asked by At

I have used the following command

vmc info |grep target

I can get the target info exactly. But when I type:

vmc apps  |grep running

There is no output. If I try to redirect the stdout to file like:

vmc apps &> tmplog

I was confused to see that only the first column of the output (appname) was written into the file. Any suggestions?

1

There are 1 answers

0
mana On

It may be the case that you need to redirect both unix output streams to see the complete log. There is STDOUT (1) and STDERR (2). To redirect both streams to the same file by using

vmc apps > tmplog 2 &> tmplog

Your last line above only redirected one output stream (STDOUT). The other stream may be written to to console instead.

Additionally, the vmc CLI is pretty much outdated. For the current go implementation of the CF CLI (gcf/cf), I successfully tested the following command to work

cf logs $YOUR_APP_NAME | grep RTR