Creating a Log Drain

You can configure your apps to send log messages to a syslog service such as Splunk or Papertrail. The following example demonstrates how to create a job log drain using Papertrail.

Create the Papertrail log drain

First you create a log drain on PaperTrail. Note that your Papertrail log drain must be configured to allow plain-text connections from the Apcera cluster, as explained below.

To create a log drain URL with PaperTrail:

  1. Create a Papertrail account, if you don't have one.
  2. Open the Destinations tab in Papertrail settings.
  3. Click Create log destination.
  4. Under Accept connections via… check the Plain Text option.
    Alt text
  5. Click Update.
  6. At the top of the next page, copy the syslog URL and port provided to you (for example, logs4.papertrailapp.com:10155).

    Alt text

Next you'll configure an application to use the new log drain.

Add the Log Drain to an Application

Once you create a log drain you add it to one or more applications using APC.

To add the log drain to an application:

  1. Open a terminal and enter the following command, replacing <url:port> with the URL and port number of your Papertrail log drain, and replace <app-name> with the application name whose logs should drain to this URL:

     apc drain add syslog://<url:port> --app <app-name>
    

    For example:

     apc drain add syslog://logs2.papertrailapp.com:12345  --app my-app
    
  2. To verify that the log drain was added to the app, run the apc drain list command, passing it the name of the app:

     apc drain list --app my-app
     Drains on my-app:
     ╭────────────────────────────────────────┬────────────────────────╮
     │ URL                                    │ Max Entry Size (bytes) │
     ├────────────────────────────────────────┼────────────────────────┤
     │ syslog://logs2.papertrailapp.com:12345 │ 2048                   │
     ╰────────────────────────────────────────┴──────────────────────       
    

To view your application's log events in PaperTrail, open papertrailapp.com/events. You should see log messages from your application appear in the list of events.

If you don't see any events, make sure that you enabled plain-text communication between Apcera and Papertrail (see Create the Papertrail log drain and that your application is actually logging events.