api for showing logs

348 views
Skip to first unread message

CF Rakesh

unread,
Mar 23, 2015, 4:52:19 PM3/23/15
to vcap...@cloudfoundry.org
Hello All,

I am interested to know if I there is a cf API to show logs of an application. In short, is there an api for cf logs <appname> ? I tried searching I couldn't find one, kindly let me know.

Thanks,
Rakesh

Ken Krueger

unread,
Mar 23, 2015, 5:24:01 PM3/23/15
to vcap...@cloudfoundry.org
Hi Rakesh,

CF doesn't really store logs, so there is no real command to retrieve them.  Instead adoption of a third party log manager (Splunk, LogStash, Paper trail, sumo logic, etc. etc.) is encouraged.  Your options are:

- cf logs <app> - gives you a live stream of your apps logs
- cf logs <app> --recent  - gives you a snippet of the last bit of log activity, VERY useful when debugging push problems
- syslog draining to a third party log manager - recommended, see http://docs.cloudfoundry.org/devguide/services/log-management.html 

It IS possible to use the cf files <app> command to obtain an individual instances ephemeral copy of its own emitted logs, but there are many reasons this approach is not encouraged (only a single instance, no way to manage the logs, only available when app is running, lost when application stops, etc. etc.)

Hope that helps,
k

--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/9e29e633-ab86-4725-845e-6d70b6ddfd4c%40cloudfoundry.org.

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.



--
Ken Krueger  
Manager, Global Education Delivery
407 256 9737 Mobile
kenkrueger65 Skype

Education questions?  educ...@pivotal.io

Scott Frederick

unread,
Mar 23, 2015, 6:28:14 PM3/23/15
to vcap...@cloudfoundry.org
Rakesh, 

If you run the command "cf curl /v2/info", you will see the "logging_endpoint" URL, which is the API endpoint for retrieving logs via loggregator. As Ken said, loggregator only caches a very small amount of logs for each app, so using its API is sufficient for streaming log content or retrieving the most recent few lines of an app's log output. The API for loggregator streaming and recent logs uses websockets and protocol buffers, but otherwise isn't very well documented. If you want more details, the best idea is to read the source code for either the Go CLI[1] or the Java Client library[2]. 

Scott

Alexander Jackson

unread,
Mar 23, 2015, 11:49:37 PM3/23/15
to vcap...@cloudfoundry.org
In addition to the Java api there is a go api called noaa[0] this is the newest api that the cli is will soon use.  It supports both log and metric data types.
The older go api lib[1] is still avaiable but doesn't support metric data type just the log data type, this is currently used by the cli.

    - Alex.


--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.

Greg Oehmen

unread,
Mar 24, 2015, 12:31:37 AM3/24/15
to vcap-dev
THe CLI team started the work to use noaa today [0].  It will very likely be in the next release of the CLi.  



Greg Oehmen
Cloud Foundry Product Manager


Reply all
Reply to author
Forward
0 new messages