{"action":"created","issue":{"url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi/issues/14","repository_url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi","labels_url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi/issues/14/comments","events_url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi/issues/14/events","html_url":"https://github.com/LandRegistry-Ops/puppet-wsgi/pull/14","id":175298918,"number":14,"title":"Major logging enhancements","user":{"login":"benfairless","id":5775911,"avatar_url":"https://avatars.githubusercontent.com/u/5775911?v=3","gravatar_id":"","url":"https://api.github.com/users/benfairless","html_url":"https://github.com/benfairless","followers_url":"https://api.github.com/users/benfairless/followers","following_url":"https://api.github.com/users/benfairless/following{/other_user}","gists_url":"https://api.github.com/users/benfairless/gists{/gist_id}","starred_url":"https://api.github.com/users/benfairless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benfairless/subscriptions","organizations_url":"https://api.github.com/users/benfairless/orgs","repos_url":"https://api.github.com/users/benfairless/repos","events_url":"https://api.github.com/users/benfairless/events{/privacy}","received_events_url":"https://api.github.com/users/benfairless/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-06T17:01:23Z","updated_at":"2016-09-06T17:09:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi/pulls/14","html_url":"https://github.com/LandRegistry-Ops/puppet-wsgi/pull/14","diff_url":"https://github.com/LandRegistry-Ops/puppet-wsgi/pull/14.diff","patch_url":"https://github.com/LandRegistry-Ops/puppet-wsgi/pull/14.patch"},"body":"I've added a few new features around improving the logging configuration for applications.\r\n\r\nFirstly, in commit 17c0f16 I've added logrotate configurations in for all the applications. I haven't provided any configuration options for this so all applications will have their logs rotated weekly for four weeks and logs older than four weeks will be removed. This should reduce the risk of filesystem growth from logs.\r\n\r\nSecondly, in commit e9435a3 I have added an additional log file, `application.log` to all the projects, designed to provide a standard output stream for log messages which aren't necessarily errors.\r\n\r\nLastly, in commit 841a1d9 I have added support for centralising log outputs using filebeat. Currently, until we have a better understanding of the logging standards for Java apps, it only supports the `wsgi` application type. To enable logging you can simply add the `logging => true` line to the application resource when defining it.\r\n\r\nI've been able to attach some useful metadata to the log entries when they are shipped from filebeat. Here is an example:\r\n```json\r\n{\r\n  \"@timestamp\": \"2016-09-06T16:45:21.869Z\",\r\n  \"beat\": {\r\n    \"hostname\": \"landregistry.box\",\r\n    \"name\": \"landregistry.box\"\r\n  },\r\n  \"count\": 1,\r\n  \"fields\": {\r\n    \"application\": \"ha-demo\",\r\n    \"environment\": \"development\",\r\n    \"version\": \"master\"\r\n  },\r\n  \"input_type\": \"log\",\r\n  \"message\": \"127.0.0.1 - - [06/Sep/2016:17:45:15 +0100] \\\"GET /backend HTTP/1.1\\\" 200 31 \\\"-\\\" \\\"curl/7.29.0\\\"\",\r\n  \"offset\": 0,\r\n  \"source\": \"/opt/landregistry/applications/ha-demo/logs/access.log\",\r\n  \"type\": \"access\"\r\n}\r\n{\r\n  \"@timestamp\": \"2016-09-06T16:45:21.869Z\",\r\n  \"beat\": {\r\n    \"hostname\": \"landregistry.box\",\r\n    \"name\": \"landregistry.box\"\r\n  },\r\n  \"count\": 1,\r\n  \"fields\": {\r\n    \"application\": \"ha-demo\",\r\n    \"environment\": \"development\",\r\n    \"version\": \"master\"\r\n  },\r\n  \"input_type\": \"log\",\r\n  \"message\": \"INFO:root:Backend triggered on landregistry.box\",\r\n  \"offset\": 0,\r\n  \"source\": \"/opt/landregistry/applications/ha-demo/logs/application.log\",\r\n  \"type\": \"lr-application\"\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi/issues/comments/245020064","html_url":"https://github.com/LandRegistry-Ops/puppet-wsgi/pull/14#issuecomment-245020064","issue_url":"https://api.github.com/repos/LandRegistry-Ops/puppet-wsgi/issues/14","id":245020064,"user":{"login":"benfairless","id":5775911,"avatar_url":"https://avatars.githubusercontent.com/u/5775911?v=3","gravatar_id":"","url":"https://api.github.com/users/benfairless","html_url":"https://github.com/benfairless","followers_url":"https://api.github.com/users/benfairless/followers","following_url":"https://api.github.com/users/benfairless/following{/other_user}","gists_url":"https://api.github.com/users/benfairless/gists{/gist_id}","starred_url":"https://api.github.com/users/benfairless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benfairless/subscriptions","organizations_url":"https://api.github.com/users/benfairless/orgs","repos_url":"https://api.github.com/users/benfairless/repos","events_url":"https://api.github.com/users/benfairless/events{/privacy}","received_events_url":"https://api.github.com/users/benfairless/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T17:09:03Z","updated_at":"2016-09-06T17:09:03Z","body":"There are additional fields we can probably attach, it's just a matter of identifying what is useful. It would probably be nice to have the project that an application is part of as a field.\r\n\r\nI'm happy to hold off merging this until we've had some time to flesh out the filebeat configuration if other people would like to experiment with it."}}
{"actor":{"display_login":"benfairless"}}