{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/beats/pulls/comments/220167446","pull_request_review_id":158509869,"id":220167446,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMDE2NzQ0Ng==","diff_hunk":"@@ -0,0 +1,209 @@\n+// Licensed to Elasticsearch B.V. under one or more contributor\n+// license agreements. See the NOTICE file distributed with\n+// this work for additional information regarding copyright\n+// ownership. Elasticsearch B.V. licenses this file to you under\n+// the Apache License, Version 2.0 (the \"License\"); you may\n+// not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing,\n+// software distributed under the License is distributed on an\n+// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+// KIND, either express or implied.  See the License for the\n+// specific language governing permissions and limitations\n+// under the License.\n+\n+package file\n+\n+import (\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"sort\"\n+\t\"strconv\"\n+\t\"time\"\n+)\n+\n+type intervalRotator struct {\n+\tinterval    time.Duration\n+\tlastRotate  time.Time\n+\tfileFormat  string\n+\tclock       clock\n+\tweekly      bool\n+\tarbitrary   bool\n+\tnewInterval func(lastTime time.Time, currentTime time.Time) bool\n+}\n+\n+type clock interface {","path":"libbeat/common/file/interval_rotator.go","position":38,"original_position":38,"commit_id":"59da0d71ed00f52fca41565d30248c8e80565f66","original_commit_id":"59da0d71ed00f52fca41565d30248c8e80565f66","user":{"login":"kvch","id":3876218,"node_id":"MDQ6VXNlcjM4NzYyMTg=","avatar_url":"https://avatars1.githubusercontent.com/u/3876218?v=4","gravatar_id":"","url":"https://api.github.com/users/kvch","html_url":"https://github.com/kvch","followers_url":"https://api.github.com/users/kvch/followers","following_url":"https://api.github.com/users/kvch/following{/other_user}","gists_url":"https://api.github.com/users/kvch/gists{/gist_id}","starred_url":"https://api.github.com/users/kvch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvch/subscriptions","organizations_url":"https://api.github.com/users/kvch/orgs","repos_url":"https://api.github.com/users/kvch/repos","events_url":"https://api.github.com/users/kvch/events{/privacy}","received_events_url":"https://api.github.com/users/kvch/received_events","type":"User","site_admin":false},"body":"Why does this interface exists? What's the reason of having a `realClock`? Why not simply call `time.Now` directly instead of through an interface?","created_at":"2018-09-25T12:16:45Z","updated_at":"2018-09-25T12:16:46Z","html_url":"https://github.com/elastic/beats/pull/8349#discussion_r220167446","pull_request_url":"https://api.github.com/repos/elastic/beats/pulls/8349","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/elastic/beats/pulls/comments/220167446"},"html":{"href":"https://github.com/elastic/beats/pull/8349#discussion_r220167446"},"pull_request":{"href":"https://api.github.com/repos/elastic/beats/pulls/8349"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/beats/pulls/8349","id":216401223,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NDAxMjIz","html_url":"https://github.com/elastic/beats/pull/8349","diff_url":"https://github.com/elastic/beats/pull/8349.diff","patch_url":"https://github.com/elastic/beats/pull/8349.patch","issue_url":"https://api.github.com/repos/elastic/beats/issues/8349","number":8349,"state":"open","locked":false,"title":"Log rotation by time interval","user":{"login":"danhermann","id":22777892,"node_id":"MDQ6VXNlcjIyNzc3ODky","avatar_url":"https://avatars0.githubusercontent.com/u/22777892?v=4","gravatar_id":"","url":"https://api.github.com/users/danhermann","html_url":"https://github.com/danhermann","followers_url":"https://api.github.com/users/danhermann/followers","following_url":"https://api.github.com/users/danhermann/following{/other_user}","gists_url":"https://api.github.com/users/danhermann/gists{/gist_id}","starred_url":"https://api.github.com/users/danhermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danhermann/subscriptions","organizations_url":"https://api.github.com/users/danhermann/orgs","repos_url":"https://api.github.com/users/danhermann/repos","events_url":"https://api.github.com/users/danhermann/events{/privacy}","received_events_url":"https://api.github.com/users/danhermann/received_events","type":"User","site_admin":false},"body":"Adds optional log rotation by time interval in addition to size-based log rotation. It's modeled after ES's log rotation which defaults to daily log rotation in which the current log file is rotated to _filename_-yyyy-MM-dd-n where _n_ is incremented if either the max file size is reached or a beat is started more than once per day. The rotation interval is configurable down to `1s`. Values of `1m`, `1h`, `24h`, `7*24h`, `30*24h`, and `365*24h` are treated specially by being boundary-aligned with minutes, hours, days, weeks, months, and years as reported by the local system clock.\r\n\r\nThe `keepfiles` setting is also honored as the oldest backup files are removed during rotation.\r\n\r\nFixes #7990.\r\n","created_at":"2018-09-18T18:26:26Z","updated_at":"2018-09-25T12:16:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff7734bbb4c5fa4581322d91d628bd8a6a3fef95","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":294278853,"node_id":"MDU6TGFiZWwyOTQyNzg4NTM=","url":"https://api.github.com/repos/elastic/beats/labels/libbeat","name":"libbeat","color":"008000","default":false},{"id":228068770,"node_id":"MDU6TGFiZWwyMjgwNjg3NzA=","url":"https://api.github.com/repos/elastic/beats/labels/review","name":"review","color":"207de5","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/beats/pulls/8349/commits","review_comments_url":"https://api.github.com/repos/elastic/beats/pulls/8349/comments","review_comment_url":"https://api.github.com/repos/elastic/beats/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/beats/issues/8349/comments","statuses_url":"https://api.github.com/repos/elastic/beats/statuses/59da0d71ed00f52fca41565d30248c8e80565f66","head":{"label":"danhermann:log_rotation_by_day","ref":"log_rotation_by_day","sha":"59da0d71ed00f52fca41565d30248c8e80565f66","user":{"login":"danhermann","id":22777892,"node_id":"MDQ6VXNlcjIyNzc3ODky","avatar_url":"https://avatars0.githubusercontent.com/u/22777892?v=4","gravatar_id":"","url":"https://api.github.com/users/danhermann","html_url":"https://github.com/danhermann","followers_url":"https://api.github.com/users/danhermann/followers","following_url":"https://api.github.com/users/danhermann/following{/other_user}","gists_url":"https://api.github.com/users/danhermann/gists{/gist_id}","starred_url":"https://api.github.com/users/danhermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danhermann/subscriptions","organizations_url":"https://api.github.com/users/danhermann/orgs","repos_url":"https://api.github.com/users/danhermann/repos","events_url":"https://api.github.com/users/danhermann/events{/privacy}","received_events_url":"https://api.github.com/users/danhermann/received_events","type":"User","site_admin":false},"repo":{"id":138615126,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg2MTUxMjY=","name":"beats","full_name":"danhermann/beats","private":false,"owner":{"login":"danhermann","id":22777892,"node_id":"MDQ6VXNlcjIyNzc3ODky","avatar_url":"https://avatars0.githubusercontent.com/u/22777892?v=4","gravatar_id":"","url":"https://api.github.com/users/danhermann","html_url":"https://github.com/danhermann","followers_url":"https://api.github.com/users/danhermann/followers","following_url":"https://api.github.com/users/danhermann/following{/other_user}","gists_url":"https://api.github.com/users/danhermann/gists{/gist_id}","starred_url":"https://api.github.com/users/danhermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danhermann/subscriptions","organizations_url":"https://api.github.com/users/danhermann/orgs","repos_url":"https://api.github.com/users/danhermann/repos","events_url":"https://api.github.com/users/danhermann/events{/privacy}","received_events_url":"https://api.github.com/users/danhermann/received_events","type":"User","site_admin":false},"html_url":"https://github.com/danhermann/beats","description":":tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash ","fork":true,"url":"https://api.github.com/repos/danhermann/beats","forks_url":"https://api.github.com/repos/danhermann/beats/forks","keys_url":"https://api.github.com/repos/danhermann/beats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danhermann/beats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danhermann/beats/teams","hooks_url":"https://api.github.com/repos/danhermann/beats/hooks","issue_events_url":"https://api.github.com/repos/danhermann/beats/issues/events{/number}","events_url":"https://api.github.com/repos/danhermann/beats/events","assignees_url":"https://api.github.com/repos/danhermann/beats/assignees{/user}","branches_url":"https://api.github.com/repos/danhermann/beats/branches{/branch}","tags_url":"https://api.github.com/repos/danhermann/beats/tags","blobs_url":"https://api.github.com/repos/danhermann/beats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danhermann/beats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danhermann/beats/git/refs{/sha}","trees_url":"https://api.github.com/repos/danhermann/beats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danhermann/beats/statuses/{sha}","languages_url":"https://api.github.com/repos/danhermann/beats/languages","stargazers_url":"https://api.github.com/repos/danhermann/beats/stargazers","contributors_url":"https://api.github.com/repos/danhermann/beats/contributors","subscribers_url":"https://api.github.com/repos/danhermann/beats/subscribers","subscription_url":"https://api.github.com/repos/danhermann/beats/subscription","commits_url":"https://api.github.com/repos/danhermann/beats/commits{/sha}","git_commits_url":"https://api.github.com/repos/danhermann/beats/git/commits{/sha}","comments_url":"https://api.github.com/repos/danhermann/beats/comments{/number}","issue_comment_url":"https://api.github.com/repos/danhermann/beats/issues/comments{/number}","contents_url":"https://api.github.com/repos/danhermann/beats/contents/{+path}","compare_url":"https://api.github.com/repos/danhermann/beats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danhermann/beats/merges","archive_url":"https://api.github.com/repos/danhermann/beats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danhermann/beats/downloads","issues_url":"https://api.github.com/repos/danhermann/beats/issues{/number}","pulls_url":"https://api.github.com/repos/danhermann/beats/pulls{/number}","milestones_url":"https://api.github.com/repos/danhermann/beats/milestones{/number}","notifications_url":"https://api.github.com/repos/danhermann/beats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danhermann/beats/labels{/name}","releases_url":"https://api.github.com/repos/danhermann/beats/releases{/id}","deployments_url":"https://api.github.com/repos/danhermann/beats/deployments","created_at":"2018-06-25T15:37:06Z","updated_at":"2018-09-21T21:38:51Z","pushed_at":"2018-09-21T22:18:54Z","git_url":"git://github.com/danhermann/beats.git","ssh_url":"git@github.com:danhermann/beats.git","clone_url":"https://github.com/danhermann/beats.git","svn_url":"https://github.com/danhermann/beats","homepage":"https://www.elastic.co/products/beats","size":89730,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"8563a5ac4a7925542b173f5a376b6ab5eb128039","user":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":16554739,"node_id":"MDEwOlJlcG9zaXRvcnkxNjU1NDczOQ==","name":"beats","full_name":"elastic/beats","private":false,"owner":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/elastic/beats","description":":tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash ","fork":false,"url":"https://api.github.com/repos/elastic/beats","forks_url":"https://api.github.com/repos/elastic/beats/forks","keys_url":"https://api.github.com/repos/elastic/beats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/beats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/beats/teams","hooks_url":"https://api.github.com/repos/elastic/beats/hooks","issue_events_url":"https://api.github.com/repos/elastic/beats/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/beats/events","assignees_url":"https://api.github.com/repos/elastic/beats/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/beats/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/beats/tags","blobs_url":"https://api.github.com/repos/elastic/beats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/beats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/beats/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/beats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/beats/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/beats/languages","stargazers_url":"https://api.github.com/repos/elastic/beats/stargazers","contributors_url":"https://api.github.com/repos/elastic/beats/contributors","subscribers_url":"https://api.github.com/repos/elastic/beats/subscribers","subscription_url":"https://api.github.com/repos/elastic/beats/subscription","commits_url":"https://api.github.com/repos/elastic/beats/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/beats/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/beats/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/beats/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/beats/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/beats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/beats/merges","archive_url":"https://api.github.com/repos/elastic/beats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/beats/downloads","issues_url":"https://api.github.com/repos/elastic/beats/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/beats/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/beats/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/beats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/beats/labels{/name}","releases_url":"https://api.github.com/repos/elastic/beats/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/beats/deployments","created_at":"2014-02-05T19:01:02Z","updated_at":"2018-09-25T10:48:23Z","pushed_at":"2018-09-25T12:07:34Z","git_url":"git://github.com/elastic/beats.git","ssh_url":"git@github.com:elastic/beats.git","clone_url":"https://github.com/elastic/beats.git","svn_url":"https://github.com/elastic/beats","homepage":"https://www.elastic.co/products/beats","size":98550,"stargazers_count":6165,"watchers_count":6165,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1921,"mirror_url":null,"archived":false,"open_issues_count":913,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1921,"open_issues":913,"watchers":6165,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/beats/pulls/8349"},"html":{"href":"https://github.com/elastic/beats/pull/8349"},"issue":{"href":"https://api.github.com/repos/elastic/beats/issues/8349"},"comments":{"href":"https://api.github.com/repos/elastic/beats/issues/8349/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/beats/pulls/8349/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/beats/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/beats/pulls/8349/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/beats/statuses/59da0d71ed00f52fca41565d30248c8e80565f66"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kvch"}}