Search code examples
downloadcloud-foundryswisscomdev

How can I download a logfile from Swisscom cloud foundry


I use ELK and write some additional (extensive) log information to a file called extensive.log.

How can I download this file to my local hard drive for further analysis?

I tried the cf-download plugin. But I do get a "permission or corrupt" error.

$ cf download app-name /home/SOME-PATH/logs/extensive.log


Solution

  • You don't need any plugins, you can use scp or sftp.

    The documentation is here, but this is a summary:

    1. cf login and cf target
    2. cf curl /v2/info | jq .app_ssh_endpoint this is your SSH host
    3. cf ssh-code then copy the value, this is your password
    4. cf app app-name --guid this is part of your user name
    5. sftp -P 2222 cf:<app-guid>/<app-instance-num>@<ssh-host>, when prompted for a password, enter the passcode you copied in step #3.

    Similarly, for scp you can run scp -P 2222 -oUser=cf:<app-guid>/<app-instance-num> my-local-file.json <ssh-host>:my-remote-file.json.

    Hope that helps!