{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/ktestutil/pulls/comments/123033316","pull_request_review_id":45199984,"id":123033316,"diff_hunk":"@@ -0,0 +1,68 @@\n+package scp\n+\n+import (\n+\t\"io/ioutil\"\n+\t\"log\"\n+\t\"net\"\n+\t\"os\"\n+","path":"log-collector/pkg/scp/ssh.go","position":8,"original_position":8,"commit_id":"e9e5a69c3d770f96ca09866e0a0cb0576183d8f5","original_commit_id":"e9e5a69c3d770f96ca09866e0a0cb0576183d8f5","user":{"login":"xiang90","id":4479947,"avatar_url":"https://avatars3.githubusercontent.com/u/4479947?v=3","gravatar_id":"","url":"https://api.github.com/users/xiang90","html_url":"https://github.com/xiang90","followers_url":"https://api.github.com/users/xiang90/followers","following_url":"https://api.github.com/users/xiang90/following{/other_user}","gists_url":"https://api.github.com/users/xiang90/gists{/gist_id}","starred_url":"https://api.github.com/users/xiang90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiang90/subscriptions","organizations_url":"https://api.github.com/users/xiang90/orgs","repos_url":"https://api.github.com/users/xiang90/repos","events_url":"https://api.github.com/users/xiang90/events{/privacy}","received_events_url":"https://api.github.com/users/xiang90/received_events","type":"User","site_admin":false},"body":"remove empty line here.","created_at":"2017-06-20T16:52:38Z","updated_at":"2017-06-20T16:52:39Z","html_url":"https://github.com/coreos/ktestutil/pull/1#discussion_r123033316","pull_request_url":"https://api.github.com/repos/coreos/ktestutil/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/coreos/ktestutil/pulls/comments/123033316"},"html":{"href":"https://github.com/coreos/ktestutil/pull/1#discussion_r123033316"},"pull_request":{"href":"https://api.github.com/repos/coreos/ktestutil/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/ktestutil/pulls/1","id":126432330,"html_url":"https://github.com/coreos/ktestutil/pull/1","diff_url":"https://github.com/coreos/ktestutil/pull/1.diff","patch_url":"https://github.com/coreos/ktestutil/pull/1.patch","issue_url":"https://api.github.com/repos/coreos/ktestutil/issues/1","number":1,"state":"open","locked":false,"title":"Add log-collector package","user":{"login":"abhinavdahiya","id":3481311,"avatar_url":"https://avatars1.githubusercontent.com/u/3481311?v=3","gravatar_id":"","url":"https://api.github.com/users/abhinavdahiya","html_url":"https://github.com/abhinavdahiya","followers_url":"https://api.github.com/users/abhinavdahiya/followers","following_url":"https://api.github.com/users/abhinavdahiya/following{/other_user}","gists_url":"https://api.github.com/users/abhinavdahiya/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinavdahiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinavdahiya/subscriptions","organizations_url":"https://api.github.com/users/abhinavdahiya/orgs","repos_url":"https://api.github.com/users/abhinavdahiya/repos","events_url":"https://api.github.com/users/abhinavdahiya/events{/privacy}","received_events_url":"https://api.github.com/users/abhinavdahiya/received_events","type":"User","site_admin":false},"body":"Package collector would allow collecting logs from a k8s cluster brought up with bootkube. semantics.\r\n\r\nFor example collecting logs of apiserver to local disk from cluster\r\n```go\r\nCr:= collector.New(&collector.Config{\r\n\tK8sClient:     client,\r\n\tNamespace:     namespace,\r\n})\r\nif err := cr.Start(); err != nil {\r\n\t...\r\n}\r\nif err := cr.OutputToLocal(\"/tmp/log-collector\"); err != nil {\r\n\t...\r\n}\r\n// results is an array of absolute paths to log files on disk\r\nresults, err := cr.CollectPodLogs(\"kube-apiserver\")\r\nif err != nil {\r\n\t...\r\n}\r\nif err := cr.Cleanup(); err != nil {\r\n\t...\r\n}\r\n```\r\n\r\nOr collecting logs of apiserver from cluster and uploading to s3 bucket:\r\n```go\r\ncr := collector.New(&collector.Config{\r\n\tK8sClient:     client,\r\n\tNamespace:     namespace,\r\n})\r\nif err := cr.Start(); err != nil {\r\n\t...\r\n}\r\nif err := cr.OutputToS3(os.Getenv(\"AWS_ACCESS_KEY_ID\"), \r\nos.Getenv(\"AWS_SECRET_ACCESS_KEY\"), \r\nos.Getenv(\"AWS_REGION\"), \r\n\"log-collector\", \r\n\"prefix\"); err != nil {\r\n\t...\r\n}\r\nresults, err := cr.CollectPodLogs(\"kube-apiserver\")\r\nif err != nil {\r\n\t...\r\n}\r\nif err := cr.Cleanup(); err != nil {\r\n\t...\r\n}\r\n```\r\n\r\n\r\nThings to discuss:\r\n* package structure\r\n* api\r\n\r\n/cc: @yifan-gu @xiang90 ","created_at":"2017-06-20T01:55:41Z","updated_at":"2017-06-20T16:52:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92a36982eceb11b77eeffe6bba5c7ba23a656c73","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/ktestutil/pulls/1/commits","review_comments_url":"https://api.github.com/repos/coreos/ktestutil/pulls/1/comments","review_comment_url":"https://api.github.com/repos/coreos/ktestutil/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/ktestutil/issues/1/comments","statuses_url":"https://api.github.com/repos/coreos/ktestutil/statuses/e9e5a69c3d770f96ca09866e0a0cb0576183d8f5","head":{"label":"abhinavdahiya:fluentd_log_collector","ref":"fluentd_log_collector","sha":"e9e5a69c3d770f96ca09866e0a0cb0576183d8f5","user":{"login":"abhinavdahiya","id":3481311,"avatar_url":"https://avatars1.githubusercontent.com/u/3481311?v=3","gravatar_id":"","url":"https://api.github.com/users/abhinavdahiya","html_url":"https://github.com/abhinavdahiya","followers_url":"https://api.github.com/users/abhinavdahiya/followers","following_url":"https://api.github.com/users/abhinavdahiya/following{/other_user}","gists_url":"https://api.github.com/users/abhinavdahiya/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinavdahiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinavdahiya/subscriptions","organizations_url":"https://api.github.com/users/abhinavdahiya/orgs","repos_url":"https://api.github.com/users/abhinavdahiya/repos","events_url":"https://api.github.com/users/abhinavdahiya/events{/privacy}","received_events_url":"https://api.github.com/users/abhinavdahiya/received_events","type":"User","site_admin":false},"repo":{"id":94831842,"name":"ktestutil","full_name":"abhinavdahiya/ktestutil","owner":{"login":"abhinavdahiya","id":3481311,"avatar_url":"https://avatars1.githubusercontent.com/u/3481311?v=3","gravatar_id":"","url":"https://api.github.com/users/abhinavdahiya","html_url":"https://github.com/abhinavdahiya","followers_url":"https://api.github.com/users/abhinavdahiya/followers","following_url":"https://api.github.com/users/abhinavdahiya/following{/other_user}","gists_url":"https://api.github.com/users/abhinavdahiya/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinavdahiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinavdahiya/subscriptions","organizations_url":"https://api.github.com/users/abhinavdahiya/orgs","repos_url":"https://api.github.com/users/abhinavdahiya/repos","events_url":"https://api.github.com/users/abhinavdahiya/events{/privacy}","received_events_url":"https://api.github.com/users/abhinavdahiya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abhinavdahiya/ktestutil","description":"Utilities for testing applications running atop Kubernetes","fork":true,"url":"https://api.github.com/repos/abhinavdahiya/ktestutil","forks_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/forks","keys_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/teams","hooks_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/hooks","issue_events_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/issues/events{/number}","events_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/events","assignees_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/assignees{/user}","branches_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/branches{/branch}","tags_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/tags","blobs_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/git/refs{/sha}","trees_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/statuses/{sha}","languages_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/languages","stargazers_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/stargazers","contributors_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/contributors","subscribers_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/subscribers","subscription_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/subscription","commits_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/commits{/sha}","git_commits_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/git/commits{/sha}","comments_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/comments{/number}","issue_comment_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/issues/comments{/number}","contents_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/contents/{+path}","compare_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/merges","archive_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/downloads","issues_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/issues{/number}","pulls_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/pulls{/number}","milestones_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/milestones{/number}","notifications_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/labels{/name}","releases_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/releases{/id}","deployments_url":"https://api.github.com/repos/abhinavdahiya/ktestutil/deployments","created_at":"2017-06-20T00:17:13Z","updated_at":"2017-06-16T21:59:27Z","pushed_at":"2017-06-20T06:40:45Z","git_url":"git://github.com/abhinavdahiya/ktestutil.git","ssh_url":"git@github.com:abhinavdahiya/ktestutil.git","clone_url":"https://github.com/abhinavdahiya/ktestutil.git","svn_url":"https://github.com/abhinavdahiya/ktestutil","homepage":null,"size":18,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"coreos:master","ref":"master","sha":"2bfc9c016be4237db6d5d7f57782ecdece0b8a78","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars0.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":94584203,"name":"ktestutil","full_name":"coreos/ktestutil","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars0.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/ktestutil","description":"Utilities for testing applications running atop Kubernetes","fork":false,"url":"https://api.github.com/repos/coreos/ktestutil","forks_url":"https://api.github.com/repos/coreos/ktestutil/forks","keys_url":"https://api.github.com/repos/coreos/ktestutil/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/ktestutil/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/ktestutil/teams","hooks_url":"https://api.github.com/repos/coreos/ktestutil/hooks","issue_events_url":"https://api.github.com/repos/coreos/ktestutil/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/ktestutil/events","assignees_url":"https://api.github.com/repos/coreos/ktestutil/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/ktestutil/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/ktestutil/tags","blobs_url":"https://api.github.com/repos/coreos/ktestutil/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/ktestutil/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/ktestutil/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/ktestutil/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/ktestutil/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/ktestutil/languages","stargazers_url":"https://api.github.com/repos/coreos/ktestutil/stargazers","contributors_url":"https://api.github.com/repos/coreos/ktestutil/contributors","subscribers_url":"https://api.github.com/repos/coreos/ktestutil/subscribers","subscription_url":"https://api.github.com/repos/coreos/ktestutil/subscription","commits_url":"https://api.github.com/repos/coreos/ktestutil/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/ktestutil/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/ktestutil/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/ktestutil/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/ktestutil/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/ktestutil/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/ktestutil/merges","archive_url":"https://api.github.com/repos/coreos/ktestutil/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/ktestutil/downloads","issues_url":"https://api.github.com/repos/coreos/ktestutil/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/ktestutil/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/ktestutil/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/ktestutil/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/ktestutil/labels{/name}","releases_url":"https://api.github.com/repos/coreos/ktestutil/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/ktestutil/deployments","created_at":"2017-06-16T21:59:27Z","updated_at":"2017-06-16T21:59:27Z","pushed_at":"2017-06-20T06:40:46Z","git_url":"git://github.com/coreos/ktestutil.git","ssh_url":"git@github.com:coreos/ktestutil.git","clone_url":"https://github.com/coreos/ktestutil.git","svn_url":"https://github.com/coreos/ktestutil","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/ktestutil/pulls/1"},"html":{"href":"https://github.com/coreos/ktestutil/pull/1"},"issue":{"href":"https://api.github.com/repos/coreos/ktestutil/issues/1"},"comments":{"href":"https://api.github.com/repos/coreos/ktestutil/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/ktestutil/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/ktestutil/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/ktestutil/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/ktestutil/statuses/e9e5a69c3d770f96ca09866e0a0cb0576183d8f5"}}}}
{"actor":{"display_login":"xiang90"}}