{"action":"created","comment":{"url":"https://api.github.com/repos/gravitational/logging-app/pulls/comments/72271850","id":72271850,"diff_hunk":"@@ -42,9 +42,15 @@ func writer(ws *websocket.Conn, filter filter) {\n \tlog.Infof(\"active filter: %v (%v)\", filter, matcher)\n \tdefer ws.Close()\n \n-\ttailCmd := exec.Command(\"tail\", fmt.Sprintf(\"-n%v\", tailHistory), \"-f\", filePath)\n+\tvar err error\n+\tvar history io.ReadCloser\n+\ttailCmd := exec.Command(\"tail\", \"-f\", filePath)\n \tcommands := []*exec.Cmd{tailCmd}\n \tif matcher != \"\" {\n+\t\thistory, err = snapshot(matcher, filePath, tailHistory)\n+\t\tif err != nil {\n+\t\t\tlog.Errorf(\"failed to obtain %v lines of history for %v: %v\", tailHistory, matcher, trace.DebugReport(err))","path":"cmd/wstail/tail.go","position":12,"original_position":12,"commit_id":"8ab7aaa7017597e3d07aa8cfa3a16bef7b30fa2b","original_commit_id":"8ab7aaa7017597e3d07aa8cfa3a16bef7b30fa2b","user":{"login":"sofuture","id":66669,"avatar_url":"https://avatars.githubusercontent.com/u/66669?v=3","gravatar_id":"","url":"https://api.github.com/users/sofuture","html_url":"https://github.com/sofuture","followers_url":"https://api.github.com/users/sofuture/followers","following_url":"https://api.github.com/users/sofuture/following{/other_user}","gists_url":"https://api.github.com/users/sofuture/gists{/gist_id}","starred_url":"https://api.github.com/users/sofuture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sofuture/subscriptions","organizations_url":"https://api.github.com/users/sofuture/orgs","repos_url":"https://api.github.com/users/sofuture/repos","events_url":"https://api.github.com/users/sofuture/events{/privacy}","received_events_url":"https://api.github.com/users/sofuture/received_events","type":"User","site_admin":false},"body":"This is probably generally a warn (i.e. not enough history) and in the case that it's an actual error, should we abort here?","created_at":"2016-07-26T15:22:21Z","updated_at":"2016-07-26T15:22:21Z","html_url":"https://github.com/gravitational/logging-app/pull/9#discussion_r72271850","pull_request_url":"https://api.github.com/repos/gravitational/logging-app/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/gravitational/logging-app/pulls/comments/72271850"},"html":{"href":"https://github.com/gravitational/logging-app/pull/9#discussion_r72271850"},"pull_request":{"href":"https://api.github.com/repos/gravitational/logging-app/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/gravitational/logging-app/pulls/9","id":78851894,"html_url":"https://github.com/gravitational/logging-app/pull/9","diff_url":"https://github.com/gravitational/logging-app/pull/9.diff","patch_url":"https://github.com/gravitational/logging-app/pull/9.patch","issue_url":"https://api.github.com/repos/gravitational/logging-app/issues/9","number":9,"state":"open","locked":false,"title":"Dmitri/tail initial history","user":{"login":"a-palchikov","id":965809,"avatar_url":"https://avatars.githubusercontent.com/u/965809?v=3","gravatar_id":"","url":"https://api.github.com/users/a-palchikov","html_url":"https://github.com/a-palchikov","followers_url":"https://api.github.com/users/a-palchikov/followers","following_url":"https://api.github.com/users/a-palchikov/following{/other_user}","gists_url":"https://api.github.com/users/a-palchikov/gists{/gist_id}","starred_url":"https://api.github.com/users/a-palchikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-palchikov/subscriptions","organizations_url":"https://api.github.com/users/a-palchikov/orgs","repos_url":"https://api.github.com/users/a-palchikov/repos","events_url":"https://api.github.com/users/a-palchikov/events{/privacy}","received_events_url":"https://api.github.com/users/a-palchikov/received_events","type":"User","site_admin":false},"body":"This PR adds support for smarter initial history.\r\nThe original attempt at providing logging history used `tail -nK` with some arbitrary `K` to capture the last `K` lines of log messages from the aggregated storage (`/var/log/messages`). The problem with this approach is that it was not filter-sensitive and usually did not capture any (enough) information about the filtered data.\r\nAn alternative approach is running a `grep` with the specified filter first, tailing the results to some arbitrary `K` (and thus capturing only relevant details), then have the second `tail`/`grep` pipeline take care of the appended messages.","created_at":"2016-07-26T13:32:07Z","updated_at":"2016-07-26T15:22:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc059f85c287741b89648a51190d830f7814f880","assignee":{"login":"sofuture","id":66669,"avatar_url":"https://avatars.githubusercontent.com/u/66669?v=3","gravatar_id":"","url":"https://api.github.com/users/sofuture","html_url":"https://github.com/sofuture","followers_url":"https://api.github.com/users/sofuture/followers","following_url":"https://api.github.com/users/sofuture/following{/other_user}","gists_url":"https://api.github.com/users/sofuture/gists{/gist_id}","starred_url":"https://api.github.com/users/sofuture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sofuture/subscriptions","organizations_url":"https://api.github.com/users/sofuture/orgs","repos_url":"https://api.github.com/users/sofuture/repos","events_url":"https://api.github.com/users/sofuture/events{/privacy}","received_events_url":"https://api.github.com/users/sofuture/received_events","type":"User","site_admin":false},"assignees":[{"login":"sofuture","id":66669,"avatar_url":"https://avatars.githubusercontent.com/u/66669?v=3","gravatar_id":"","url":"https://api.github.com/users/sofuture","html_url":"https://github.com/sofuture","followers_url":"https://api.github.com/users/sofuture/followers","following_url":"https://api.github.com/users/sofuture/following{/other_user}","gists_url":"https://api.github.com/users/sofuture/gists{/gist_id}","starred_url":"https://api.github.com/users/sofuture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sofuture/subscriptions","organizations_url":"https://api.github.com/users/sofuture/orgs","repos_url":"https://api.github.com/users/sofuture/repos","events_url":"https://api.github.com/users/sofuture/events{/privacy}","received_events_url":"https://api.github.com/users/sofuture/received_events","type":"User","site_admin":false},{"login":"r0mant","id":339322,"avatar_url":"https://avatars.githubusercontent.com/u/339322?v=3","gravatar_id":"","url":"https://api.github.com/users/r0mant","html_url":"https://github.com/r0mant","followers_url":"https://api.github.com/users/r0mant/followers","following_url":"https://api.github.com/users/r0mant/following{/other_user}","gists_url":"https://api.github.com/users/r0mant/gists{/gist_id}","starred_url":"https://api.github.com/users/r0mant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r0mant/subscriptions","organizations_url":"https://api.github.com/users/r0mant/orgs","repos_url":"https://api.github.com/users/r0mant/repos","events_url":"https://api.github.com/users/r0mant/events{/privacy}","received_events_url":"https://api.github.com/users/r0mant/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/gravitational/logging-app/pulls/9/commits","review_comments_url":"https://api.github.com/repos/gravitational/logging-app/pulls/9/comments","review_comment_url":"https://api.github.com/repos/gravitational/logging-app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gravitational/logging-app/issues/9/comments","statuses_url":"https://api.github.com/repos/gravitational/logging-app/statuses/8ab7aaa7017597e3d07aa8cfa3a16bef7b30fa2b","head":{"label":"gravitational:dmitri/tail-initial-history","ref":"dmitri/tail-initial-history","sha":"8ab7aaa7017597e3d07aa8cfa3a16bef7b30fa2b","user":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars.githubusercontent.com/u/10781132?v=3","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"repo":{"id":61620959,"name":"logging-app","full_name":"gravitational/logging-app","owner":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars.githubusercontent.com/u/10781132?v=3","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gravitational/logging-app","description":"This gravity app provides an rsyslog-based log collection system to gravity sites.","fork":false,"url":"https://api.github.com/repos/gravitational/logging-app","forks_url":"https://api.github.com/repos/gravitational/logging-app/forks","keys_url":"https://api.github.com/repos/gravitational/logging-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gravitational/logging-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gravitational/logging-app/teams","hooks_url":"https://api.github.com/repos/gravitational/logging-app/hooks","issue_events_url":"https://api.github.com/repos/gravitational/logging-app/issues/events{/number}","events_url":"https://api.github.com/repos/gravitational/logging-app/events","assignees_url":"https://api.github.com/repos/gravitational/logging-app/assignees{/user}","branches_url":"https://api.github.com/repos/gravitational/logging-app/branches{/branch}","tags_url":"https://api.github.com/repos/gravitational/logging-app/tags","blobs_url":"https://api.github.com/repos/gravitational/logging-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gravitational/logging-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gravitational/logging-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/gravitational/logging-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gravitational/logging-app/statuses/{sha}","languages_url":"https://api.github.com/repos/gravitational/logging-app/languages","stargazers_url":"https://api.github.com/repos/gravitational/logging-app/stargazers","contributors_url":"https://api.github.com/repos/gravitational/logging-app/contributors","subscribers_url":"https://api.github.com/repos/gravitational/logging-app/subscribers","subscription_url":"https://api.github.com/repos/gravitational/logging-app/subscription","commits_url":"https://api.github.com/repos/gravitational/logging-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/gravitational/logging-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/gravitational/logging-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/gravitational/logging-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/gravitational/logging-app/contents/{+path}","compare_url":"https://api.github.com/repos/gravitational/logging-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gravitational/logging-app/merges","archive_url":"https://api.github.com/repos/gravitational/logging-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gravitational/logging-app/downloads","issues_url":"https://api.github.com/repos/gravitational/logging-app/issues{/number}","pulls_url":"https://api.github.com/repos/gravitational/logging-app/pulls{/number}","milestones_url":"https://api.github.com/repos/gravitational/logging-app/milestones{/number}","notifications_url":"https://api.github.com/repos/gravitational/logging-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gravitational/logging-app/labels{/name}","releases_url":"https://api.github.com/repos/gravitational/logging-app/releases{/id}","deployments_url":"https://api.github.com/repos/gravitational/logging-app/deployments","created_at":"2016-06-21T09:32:50Z","updated_at":"2016-07-25T22:56:54Z","pushed_at":"2016-07-26T13:32:07Z","git_url":"git://github.com/gravitational/logging-app.git","ssh_url":"git@github.com:gravitational/logging-app.git","clone_url":"https://github.com/gravitational/logging-app.git","svn_url":"https://github.com/gravitational/logging-app","homepage":null,"size":2366,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"gravitational:master","ref":"master","sha":"11eaf83bcbeef46ee41a24bd127107a1e77b4d06","user":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars.githubusercontent.com/u/10781132?v=3","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"repo":{"id":61620959,"name":"logging-app","full_name":"gravitational/logging-app","owner":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars.githubusercontent.com/u/10781132?v=3","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gravitational/logging-app","description":"This gravity app provides an rsyslog-based log collection system to gravity sites.","fork":false,"url":"https://api.github.com/repos/gravitational/logging-app","forks_url":"https://api.github.com/repos/gravitational/logging-app/forks","keys_url":"https://api.github.com/repos/gravitational/logging-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gravitational/logging-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gravitational/logging-app/teams","hooks_url":"https://api.github.com/repos/gravitational/logging-app/hooks","issue_events_url":"https://api.github.com/repos/gravitational/logging-app/issues/events{/number}","events_url":"https://api.github.com/repos/gravitational/logging-app/events","assignees_url":"https://api.github.com/repos/gravitational/logging-app/assignees{/user}","branches_url":"https://api.github.com/repos/gravitational/logging-app/branches{/branch}","tags_url":"https://api.github.com/repos/gravitational/logging-app/tags","blobs_url":"https://api.github.com/repos/gravitational/logging-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gravitational/logging-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gravitational/logging-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/gravitational/logging-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gravitational/logging-app/statuses/{sha}","languages_url":"https://api.github.com/repos/gravitational/logging-app/languages","stargazers_url":"https://api.github.com/repos/gravitational/logging-app/stargazers","contributors_url":"https://api.github.com/repos/gravitational/logging-app/contributors","subscribers_url":"https://api.github.com/repos/gravitational/logging-app/subscribers","subscription_url":"https://api.github.com/repos/gravitational/logging-app/subscription","commits_url":"https://api.github.com/repos/gravitational/logging-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/gravitational/logging-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/gravitational/logging-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/gravitational/logging-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/gravitational/logging-app/contents/{+path}","compare_url":"https://api.github.com/repos/gravitational/logging-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gravitational/logging-app/merges","archive_url":"https://api.github.com/repos/gravitational/logging-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gravitational/logging-app/downloads","issues_url":"https://api.github.com/repos/gravitational/logging-app/issues{/number}","pulls_url":"https://api.github.com/repos/gravitational/logging-app/pulls{/number}","milestones_url":"https://api.github.com/repos/gravitational/logging-app/milestones{/number}","notifications_url":"https://api.github.com/repos/gravitational/logging-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gravitational/logging-app/labels{/name}","releases_url":"https://api.github.com/repos/gravitational/logging-app/releases{/id}","deployments_url":"https://api.github.com/repos/gravitational/logging-app/deployments","created_at":"2016-06-21T09:32:50Z","updated_at":"2016-07-25T22:56:54Z","pushed_at":"2016-07-26T13:32:07Z","git_url":"git://github.com/gravitational/logging-app.git","ssh_url":"git@github.com:gravitational/logging-app.git","clone_url":"https://github.com/gravitational/logging-app.git","svn_url":"https://github.com/gravitational/logging-app","homepage":null,"size":2366,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gravitational/logging-app/pulls/9"},"html":{"href":"https://github.com/gravitational/logging-app/pull/9"},"issue":{"href":"https://api.github.com/repos/gravitational/logging-app/issues/9"},"comments":{"href":"https://api.github.com/repos/gravitational/logging-app/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/gravitational/logging-app/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/gravitational/logging-app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gravitational/logging-app/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/gravitational/logging-app/statuses/8ab7aaa7017597e3d07aa8cfa3a16bef7b30fa2b"}}}}
{"actor":{"display_login":"sofuture"}}