{"action":"created","issue":{"url":"https://api.github.com/repos/convox/kernel/issues/123","labels_url":"https://api.github.com/repos/convox/kernel/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/convox/kernel/issues/123/comments","events_url":"https://api.github.com/repos/convox/kernel/issues/123/events","html_url":"https://github.com/convox/kernel/issues/123","id":102878147,"number":123,"title":"Papertrail Integration","user":{"login":"nzoschke","id":147410,"avatar_url":"https://avatars.githubusercontent.com/u/147410?v=3","gravatar_id":"","url":"https://api.github.com/users/nzoschke","html_url":"https://github.com/nzoschke","followers_url":"https://api.github.com/users/nzoschke/followers","following_url":"https://api.github.com/users/nzoschke/following{/other_user}","gists_url":"https://api.github.com/users/nzoschke/gists{/gist_id}","starred_url":"https://api.github.com/users/nzoschke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzoschke/subscriptions","organizations_url":"https://api.github.com/users/nzoschke/orgs","repos_url":"https://api.github.com/users/nzoschke/repos","events_url":"https://api.github.com/users/nzoschke/events{/privacy}","received_events_url":"https://api.github.com/users/nzoschke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-24T19:55:45Z","updated_at":"2015-08-24T21:35:57Z","closed_at":null,"body":"Log archival and search is important for operating and debugging problems with Convox. There are many providers, but Papertrail is a great starting place.\r\n\r\nThis issue is for discussion of the design and implementation of a nice Papertrail integration.\r\n\r\n@whatupdave has had success logging convox apps to papertrail with a Lambda using a Kinesis event sources and the following code:\r\n\r\n```javascript\r\nvar winston = require('winston')\r\nrequire('winston-papertrail').Papertrail\r\n\r\nvar tr = new winston.transports.Papertrail({\r\n    host: 'X.papertrailapp.com',\r\n    port: 1234,\r\n    hostname: 'app',\r\n    program: 'process',\r\n    showLevel: false,\r\n})\r\nvar logger = new winston.Logger({ transports: [tr] })\r\n\r\nexports.handler = function(event, context) {\r\n  tr.on('connect', function() {\r\n    event.Records.forEach(function(record) {\r\n      var payload = new Buffer(record.kinesis.data, 'base64').toString('ascii')\r\n      logger.info(payload)\r\n    })\r\n    tr.close()\r\n    context.done(null)\r\n  })\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/convox/kernel/issues/comments/134387727","html_url":"https://github.com/convox/kernel/issues/123#issuecomment-134387727","issue_url":"https://api.github.com/repos/convox/kernel/issues/123","id":134387727,"user":{"login":"nzoschke","id":147410,"avatar_url":"https://avatars.githubusercontent.com/u/147410?v=3","gravatar_id":"","url":"https://api.github.com/users/nzoschke","html_url":"https://github.com/nzoschke","followers_url":"https://api.github.com/users/nzoschke/followers","following_url":"https://api.github.com/users/nzoschke/following{/other_user}","gists_url":"https://api.github.com/users/nzoschke/gists{/gist_id}","starred_url":"https://api.github.com/users/nzoschke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzoschke/subscriptions","organizations_url":"https://api.github.com/users/nzoschke/orgs","repos_url":"https://api.github.com/users/nzoschke/repos","events_url":"https://api.github.com/users/nzoschke/events{/privacy}","received_events_url":"https://api.github.com/users/nzoschke/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T21:35:57Z","updated_at":"2015-08-24T21:35:57Z","body":"A Proof of Concept based on @whatupdave's snippet is here:\r\n\r\nhttps://github.com/convox/papertrail\r\n\r\nAdding the right Papertrail tokens and creating the Lambda function is very manual right now. But it is working!\r\n\r\n![screen shot 2015-08-24 at 2 35 18 pm](https://cloud.githubusercontent.com/assets/147410/9453174/6d411958-4a6d-11e5-87bb-475a1ed168d5.png)\r\n"}}