Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use cf events?

I am currently learning cloud foundry and experimenting with different features using a simple HelloWorld toy application.

It seems that there are two commands to monitor the application cf logs HelloWorld and cf events HelloWorld

It is pretty clear to me what cf logs does and why I would use it.

Questions about cf events:

  • Under what scenario would I be interested in the output of cf events?
  • What problems can be diagnosed with cf events that can't be diagnosed with cf logs?
like image 370
ams Avatar asked Oct 25 '25 18:10

ams


2 Answers

The cf events command shows things like when an application is started or stopped. While that's not hugely interesting, it does also show crash information, like when you exceed your memory limit, and that can be helpful when debugging problems.

The cf logs or cf logs --recent command shows the logs for your application. This is generally anything that is written to STDOUT or STDERR by your application, but can also contain messages from a web server or application container depending on the software used to run your application. Also included in the stream are messages from select CF services like the router, staging and the dea.

It's also worth noting that cf logs or cf logs --recent will show the same information that you see in cf events (i.e. start, stop & crash info) although it's not formatted as well (it's a json blob) and if you have a noisy app it can be obscured among other messages.

I don't personally use cf events much, but occasionally it comes in handy when my app is acting weird and I want a quick check to see if it's been crashing.

like image 64
Daniel Mikusa Avatar answered Oct 28 '25 02:10

Daniel Mikusa


"events" use "GET /v2/events" API call - CF output about application's events in CF. "logs" shows an output to STDOUT and STDERR from an application collected by loggregator CF component.

like image 41
Alex Prismakov Avatar answered Oct 28 '25 03:10

Alex Prismakov