{"action":"created","issue":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/32790","repository_url":"https://api.github.com/repos/cockroachdb/cockroach","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/32790/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/32790/comments","events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/32790/events","html_url":"https://github.com/cockroachdb/cockroach/pull/32790","id":386900326,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1NTExNDEy","number":32790,"title":"cli: add debug merge-logs command to merge log files into a single stream.","user":{"login":"ajwerner","id":1839234,"node_id":"MDQ6VXNlcjE4MzkyMzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1839234?v=4","gravatar_id":"","url":"https://api.github.com/users/ajwerner","html_url":"https://github.com/ajwerner","followers_url":"https://api.github.com/users/ajwerner/followers","following_url":"https://api.github.com/users/ajwerner/following{/other_user}","gists_url":"https://api.github.com/users/ajwerner/gists{/gist_id}","starred_url":"https://api.github.com/users/ajwerner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajwerner/subscriptions","organizations_url":"https://api.github.com/users/ajwerner/orgs","repos_url":"https://api.github.com/users/ajwerner/repos","events_url":"https://api.github.com/users/ajwerner/events{/privacy}","received_events_url":"https://api.github.com/users/ajwerner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-12-03T16:32:49Z","updated_at":"2018-12-07T21:19:32Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/32790","html_url":"https://github.com/cockroachdb/cockroach/pull/32790","diff_url":"https://github.com/cockroachdb/cockroach/pull/32790.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/32790.patch"},"body":"Debugging distributed systems is challenging, often requiring correlating logs\r\nfrom many servers. This PR add the new `cockroach debug merge-logs` command\r\nwhich simplifies the workflow for combining logs from multiple servers. The new\r\ncommand takes a list of log files or glob patterns which expand to log file\r\nnames and combines them into a single sorted stream. By default only logs from\r\nprograms named \"cockroach\" are considered though this is controllable from the\r\n`program` flag which takes a regular expression over program name.\r\n\r\nWhen logs are merged, a prefix of the form `{{ .Details.Host }}>` are added to\r\nthe front of log messages. This can be overridden by supplying a template string\r\nto the `prefix` flag which is evaluated on a *log.FileInfo struct.\r\n\r\nThe command accepts unexpanded glob patterns to enable use in situations where\r\nthousands of files exist and shell expansion would overflow MAX_ARG_STRLEN. The\r\ncommand provides functionality to efficiently explore specific time ranges by\r\nonly reading files which might contain entries in the specified interval and by\r\nusing binary search to find an appropriate offset within files. It also provides\r\na mechanism for regular expression filtering of log line messages, something\r\nwhich is difficult to accomplish with just grep.\r\n\r\nWithin a given set of files for the same node, log messages which occur out of\r\ntime order are \"ratcheted\" to be equal to the last time seen from that node.\r\n\r\nMore thought could be given to how this command behaves in situations where a\r\nhost time may have moved backwards appreciably such that file timestamps are not\r\nproperly ordered.\r\n\r\nProposed in favor of https://github.com/cockroachdb/cockroach/pull/32435.\r\n\r\nRelease note (cli change): Adds debug merge-logs command to combine logs from multiple nodes."},"comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments/445368662","html_url":"https://github.com/cockroachdb/cockroach/pull/32790#issuecomment-445368662","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/32790","id":445368662,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTM2ODY2Mg==","user":{"login":"craig[bot]","id":37807150,"node_id":"MDM6Qm90Mzc4MDcxNTA=","avatar_url":"https://avatars0.githubusercontent.com/in/10419?v=4","gravatar_id":"","url":"https://api.github.com/users/craig%5Bbot%5D","html_url":"https://github.com/apps/craig","followers_url":"https://api.github.com/users/craig%5Bbot%5D/followers","following_url":"https://api.github.com/users/craig%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/craig%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/craig%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craig%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/craig%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/craig%5Bbot%5D/repos","events_url":"https://api.github.com/users/craig%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/craig%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2018-12-07T21:19:32Z","updated_at":"2018-12-07T21:19:32Z","author_association":"NONE","body":"# Build succeeded\n  * [GitHub CI (Cockroach)](https://teamcity.cockroachdb.com/viewLog.html?buildId=1046177&buildTypeId=Cockroach_UnitTests)"}}
{"actor":{"display_login":"craig"}}