Creating a Log Drain
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:
- Create a Papertrail account, if you don't have one.
- Open the Destinations tab in Papertrail settings.
- Click Create log destination.
- Under Accept connections via… check the Plain Text option.
- Click Update.
At the top of the next page, copy the syslog URL and port provided to you (for example,
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:
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>
apc drain add syslog://logs2.papertrailapp.com:12345 --app my-app
To verify that the log drain was added to the app, run the
apc drain listcommand, 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.