Monitoring, Metrics And Logging

Ā View Only

 Cf --logs error is not pointing to correct org

Vijay Yadav's profile image
Vijay Yadav posted Aug 30, 2018 11:22 PM

I have a pipeline setup for end to end delivery, and all the cf commands are written in pipeline itself.

While running the cf logs --<myapp> --recent command it is sometime targeting the correct org name and sometimes it is pointing to wrong org name while retrieving the logs for applications.

 

Please help me to understand the issue.

Daniel Mikusa's profile image
Daniel Mikusa

You should set `CF_HOME` to a unique directory for each job when running the cf cli in pipelines and automations. This supplies a unique path for the cf cli where it can store it's state. This includes the current token and targeted org/space.

 

Hope that helps!

Daniel Mikusa's profile image
Daniel Mikusa

A couple ways you can do this:

 

On Windows:

set CF_HOME=c:\cf-1 cf login

On Linux/Mac:

export CF_HOME=/tmp/cf-1 cf login

or you can run `CF_HOME=/tmp/cf-1 cf login`, but then you have to insert `CF_HOME=/tmp/cf-1` in front of every `cf` command that you run which can be a pain.

KOUSHIK MAITI's profile image
KOUSHIK MAITI

Hi Vijay, Just to verify that you have different spaces under different organizations. Each space has unique application. So, once you have pointed correctly [ Organization, Space, Application ] then it should display the proper logs. Can you please show me the cf commands which are written in pipeline ?

Vijay Yadav's profile image
Vijay Yadav

Hello KOUSHIK,

Thanks for your response ..!!

 

I have one space and under that I am having 2 different org like DEV and TST.

suppose I am targeting the DEV env sometime it is find that application in TST env. and not giving the correct log.

 

I am using below command to display error log.

post {

          failure {

            bat "cf logs ${pipelineParams.PCF_HostName} --recent"

          }

        }

 

Vijay Yadav's profile image
Vijay Yadav

Hello Daniel,

Thanks for your response.!!

can i get one example for that, because I am bit new to PCF and want this fix ASAPšŸ˜Š

 

Thanks in advance

KOUSHIK MAITI's profile image
KOUSHIK MAITI

Hi Vijay,

 

Did you resolve the issue ? Please follow the steps as suggested by Daniel .

Please let me know if you still requires any help from me.

 

Thanks,

Koushik