{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/32131699","id":32131699,"diff_hunk":"@@ -0,0 +1,149 @@\n+// +build linux\n+\n+package gelf\n+\n+import (\n+\t\"bytes\"\n+\t\"fmt\"\n+\t\"io\"\n+\t\"net\"\n+\t\"net/url\"\n+\t\"time\"\n+\n+\t\"github.com/Graylog2/go-gelf/gelf\"\n+\t\"github.com/Sirupsen/logrus\"\n+\t\"github.com/docker/docker/daemon/logger\"\n+\t\"github.com/docker/docker/pkg/urlutil\"\n+)\n+\n+const name = \"gelf\"\n+\n+type GelfLogger struct {\n+\twriter *gelf.Writer\n+\tctx    logger.Context\n+\tfields GelfFields\n+}\n+\n+type GelfFields struct {\n+\thostname      string\n+\tcontainerId   string\n+\tcontainerName string\n+\timageId       string\n+\timageName     string\n+\tcommand       string\n+\ttag           string\n+\tcreated       time.Time\n+}\n+\n+func init() {\n+\tif err := logger.RegisterLogDriver(name, New); err != nil {\n+\t\tlogrus.Fatal(err)\n+\t}\n+}\n+\n+func New(ctx logger.Context) (logger.Logger, error) {\n+\t// parse gelf address\n+\taddress, err := parseAddress(ctx.Config[\"gelf-address\"])\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\t// collect extra data for GELF message\n+\thostname, err := ctx.Hostname()\n+\tif err != nil {\n+\t\treturn nil, fmt.Errorf(\"gelf: can not access hostname to set source field\")\n+\t}\n+\n+\t// remove trailing slash from container name\n+\tcontainerName := bytes.TrimLeft([]byte(ctx.ContainerName), \"/\")\n+\n+\tfields := GelfFields{\n+\t\thostname:      hostname,\n+\t\tcontainerId:   ctx.ContainerID,\n+\t\tcontainerName: string(containerName),\n+\t\timageId:       ctx.ContainerImageID,\n+\t\timageName:     ctx.ContainerImageName,\n+\t\tcommand:       ctx.Command(),\n+\t\ttag:           ctx.Config[\"gelf-tag\"],\n+\t\tcreated:       ctx.ContainerCreated,\n+\t}\n+\n+\t// create new gelfWriter\n+\tgelfWriter, err := gelf.NewWriter(address)\n+\tif err != nil {\n+\t\treturn nil, fmt.Errorf(\"gelf: can not connect to GELF endpoint: %s %v\", address, err)","path":"daemon/logger/gelf/gelf.go","position":74,"original_position":74,"commit_id":"1204f52130e5a21dad919a5844779a4a23dfe764","original_commit_id":"1204f52130e5a21dad919a5844779a4a23dfe764","user":{"login":"jamtur01","id":4365,"avatar_url":"https://avatars.githubusercontent.com/u/4365?v=3","gravatar_id":"","url":"https://api.github.com/users/jamtur01","html_url":"https://github.com/jamtur01","followers_url":"https://api.github.com/users/jamtur01/followers","following_url":"https://api.github.com/users/jamtur01/following{/other_user}","gists_url":"https://api.github.com/users/jamtur01/gists{/gist_id}","starred_url":"https://api.github.com/users/jamtur01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamtur01/subscriptions","organizations_url":"https://api.github.com/users/jamtur01/orgs","repos_url":"https://api.github.com/users/jamtur01/repos","events_url":"https://api.github.com/users/jamtur01/events{/privacy}","received_events_url":"https://api.github.com/users/jamtur01/received_events","type":"User","site_admin":false},"body":"Personally - cannot over can not but not a big deal.","created_at":"2015-06-10T15:43:00Z","updated_at":"2015-06-10T15:43:00Z","html_url":"https://github.com/docker/docker/pull/13015#discussion_r32131699","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/13015","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/32131699"},"html":{"href":"https://github.com/docker/docker/pull/13015#discussion_r32131699"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/13015"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/13015","id":34818709,"html_url":"https://github.com/docker/docker/pull/13015","diff_url":"https://github.com/docker/docker/pull/13015.diff","patch_url":"https://github.com/docker/docker/pull/13015.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/13015","number":13015,"state":"open","locked":false,"title":"Add logging driver for GELF via UDP","user":{"login":"mariussturm","id":356597,"avatar_url":"https://avatars.githubusercontent.com/u/356597?v=3","gravatar_id":"","url":"https://api.github.com/users/mariussturm","html_url":"https://github.com/mariussturm","followers_url":"https://api.github.com/users/mariussturm/followers","following_url":"https://api.github.com/users/mariussturm/following{/other_user}","gists_url":"https://api.github.com/users/mariussturm/gists{/gist_id}","starred_url":"https://api.github.com/users/mariussturm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariussturm/subscriptions","organizations_url":"https://api.github.com/users/mariussturm/orgs","repos_url":"https://api.github.com/users/mariussturm/repos","events_url":"https://api.github.com/users/mariussturm/events{/privacy}","received_events_url":"https://api.github.com/users/mariussturm/received_events","type":"User","site_admin":false},"body":"A first shot of a remote logging driver. The driver sends log messages to a GELF endpoint (e.g. Graylog or Logstash/ELK) via UDP.\r\nI had to introduce a new command line option `--log-opt` in order to make the target IP and port configurable. I think this needs to be done in a better implementation but it is not exactly scope of this PR. Maybe someone from the core team can help out.\r\nCurrently you have to start the _daemon_ with  `--log-opt=gelf.host=<Graylog server ip>` and start a container with `docker run --log-driver=gelf` to send logs remotely.","created_at":"2015-05-06T13:54:22Z","updated_at":"2015-06-10T15:43:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce55b296f469141cbdbbf73d9a72c74726ce09c5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/13015/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/13015/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/13015/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/1204f52130e5a21dad919a5844779a4a23dfe764","head":{"label":"mariussturm:master","ref":"master","sha":"1204f52130e5a21dad919a5844779a4a23dfe764","user":{"login":"mariussturm","id":356597,"avatar_url":"https://avatars.githubusercontent.com/u/356597?v=3","gravatar_id":"","url":"https://api.github.com/users/mariussturm","html_url":"https://github.com/mariussturm","followers_url":"https://api.github.com/users/mariussturm/followers","following_url":"https://api.github.com/users/mariussturm/following{/other_user}","gists_url":"https://api.github.com/users/mariussturm/gists{/gist_id}","starred_url":"https://api.github.com/users/mariussturm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariussturm/subscriptions","organizations_url":"https://api.github.com/users/mariussturm/orgs","repos_url":"https://api.github.com/users/mariussturm/repos","events_url":"https://api.github.com/users/mariussturm/events{/privacy}","received_events_url":"https://api.github.com/users/mariussturm/received_events","type":"User","site_admin":false},"repo":{"id":34808174,"name":"docker","full_name":"mariussturm/docker","owner":{"login":"mariussturm","id":356597,"avatar_url":"https://avatars.githubusercontent.com/u/356597?v=3","gravatar_id":"","url":"https://api.github.com/users/mariussturm","html_url":"https://github.com/mariussturm","followers_url":"https://api.github.com/users/mariussturm/followers","following_url":"https://api.github.com/users/mariussturm/following{/other_user}","gists_url":"https://api.github.com/users/mariussturm/gists{/gist_id}","starred_url":"https://api.github.com/users/mariussturm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariussturm/subscriptions","organizations_url":"https://api.github.com/users/mariussturm/orgs","repos_url":"https://api.github.com/users/mariussturm/repos","events_url":"https://api.github.com/users/mariussturm/events{/privacy}","received_events_url":"https://api.github.com/users/mariussturm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mariussturm/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/mariussturm/docker","forks_url":"https://api.github.com/repos/mariussturm/docker/forks","keys_url":"https://api.github.com/repos/mariussturm/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mariussturm/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mariussturm/docker/teams","hooks_url":"https://api.github.com/repos/mariussturm/docker/hooks","issue_events_url":"https://api.github.com/repos/mariussturm/docker/issues/events{/number}","events_url":"https://api.github.com/repos/mariussturm/docker/events","assignees_url":"https://api.github.com/repos/mariussturm/docker/assignees{/user}","branches_url":"https://api.github.com/repos/mariussturm/docker/branches{/branch}","tags_url":"https://api.github.com/repos/mariussturm/docker/tags","blobs_url":"https://api.github.com/repos/mariussturm/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mariussturm/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mariussturm/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/mariussturm/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mariussturm/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/mariussturm/docker/languages","stargazers_url":"https://api.github.com/repos/mariussturm/docker/stargazers","contributors_url":"https://api.github.com/repos/mariussturm/docker/contributors","subscribers_url":"https://api.github.com/repos/mariussturm/docker/subscribers","subscription_url":"https://api.github.com/repos/mariussturm/docker/subscription","commits_url":"https://api.github.com/repos/mariussturm/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/mariussturm/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/mariussturm/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/mariussturm/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/mariussturm/docker/contents/{+path}","compare_url":"https://api.github.com/repos/mariussturm/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mariussturm/docker/merges","archive_url":"https://api.github.com/repos/mariussturm/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mariussturm/docker/downloads","issues_url":"https://api.github.com/repos/mariussturm/docker/issues{/number}","pulls_url":"https://api.github.com/repos/mariussturm/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/mariussturm/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/mariussturm/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mariussturm/docker/labels{/name}","releases_url":"https://api.github.com/repos/mariussturm/docker/releases{/id}","created_at":"2015-04-29T17:34:50Z","updated_at":"2015-05-07T16:03:45Z","pushed_at":"2015-06-10T10:46:57Z","git_url":"git://github.com/mariussturm/docker.git","ssh_url":"git@github.com:mariussturm/docker.git","clone_url":"https://github.com/mariussturm/docker.git","svn_url":"https://github.com/mariussturm/docker","homepage":"http://www.docker.com","size":56343,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"875eafb00b07411e361993d256adf8f459d1bafa","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-06-10T13:25:52Z","pushed_at":"2015-06-10T15:42:25Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":210562,"stargazers_count":22295,"watchers_count":22295,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5353,"mirror_url":null,"open_issues_count":1024,"forks":5353,"open_issues":1024,"watchers":22295,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/13015"},"html":{"href":"https://github.com/docker/docker/pull/13015"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/13015"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/13015/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/13015/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/13015/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/1204f52130e5a21dad919a5844779a4a23dfe764"}}}}