Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 2.65 KB

app-log-drain.adoc

File metadata and controls

54 lines (38 loc) · 2.65 KB

Application Log Draining

In this section, you will configure application log draining into a log analysis tool. We will use the free Papertrail tool, but any tool that supports tcp syslog draining can be used.

How it Works

  1. Review the log draining documentation here: http://docs.pivotal.io/pivotalcf/devguide/services/log-management.html

  2. Log draining is done through a user provided service, which gives us a means of injecting credentials and coordinates (URI’s, hostnames, ports, etc) into an application.

Papertrail

  1. Sign up for a free Papertrail account: https://papertrailapp.com/

  2. We’ve got some instructions set up Papertrail: http://docs.run.pivotal.io/devguide/services/log-management-thirdparty-svc.html#papertrail. This document is not the best and on our list of things to improve. The important part is to setup a log destination that can receive TCP plain text.

  3. In a nutshell

    1. Create a Papertrail account, fill in your email and whatnot.

    2. Navigate to "Account" on the top nav

    3. Click "Log Destinations" on the right side.

    4. Click "Alternatives"

    5. Click "I use Heroku or Cloud Foundry"

    6. "What should we call it?" should have a name

    7. Click Save

    8. Navigate to "Account" on the top nav

    9. Click "Log Destinations" on the right side.

    10. Click "Edit Settings" on your destination

    11. Ensure that "Accept logs from unrecognized systems?" has "Yes" checked

    12. Ensure PlainText is checked as an access method under "Accept Connections Via"

    13. Click create

    14. take note of the url (logs2.papertrail.com:<some-port>)

  4. Now hook it up to CF with the commands you read about above (cf cups plus some options).

  5. Be sure to add your new User Provided Service to your microservice manifest. Make sure you’re doing this in your production space!

  6. After you have bound your service and restaged your app, perform a few curl requests and ensure logs are draining into Papertrail.

  7. Scale your app to 3 instances (cf scale <app> -i 3) and generate some more load. Notice how the app index shows up in each log message, and how the UUID’s change?

More Docs

Other External Tools

Any tcp syslog compliant log tools can be used with CloudFoundry. A few popular configurations are:

  1. Log Insight

  2. Splunk Enterprise

  3. Elastic Search, Logstash & Kibana (ELK)

  4. More: http://docs.run.pivotal.io/devguide/services/log-management-thirdparty-svc.html