{"action":"created","issue":{"url":"https://api.github.com/repos/google/mtail/issues/17","repository_url":"https://api.github.com/repos/google/mtail","labels_url":"https://api.github.com/repos/google/mtail/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/google/mtail/issues/17/comments","events_url":"https://api.github.com/repos/google/mtail/issues/17/events","html_url":"https://github.com/google/mtail/issues/17","id":145352472,"number":17,"title":"Log rotation frequently fails","user":{"login":"hynek","id":41240,"avatar_url":"https://avatars.githubusercontent.com/u/41240?v=3","gravatar_id":"","url":"https://api.github.com/users/hynek","html_url":"https://github.com/hynek","followers_url":"https://api.github.com/users/hynek/followers","following_url":"https://api.github.com/users/hynek/following{/other_user}","gists_url":"https://api.github.com/users/hynek/gists{/gist_id}","starred_url":"https://api.github.com/users/hynek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hynek/subscriptions","organizations_url":"https://api.github.com/users/hynek/orgs","repos_url":"https://api.github.com/users/hynek/repos","events_url":"https://api.github.com/users/hynek/events{/privacy}","received_events_url":"https://api.github.com/users/hynek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-02T08:49:26Z","updated_at":"2016-04-03T11:35:21Z","closed_at":null,"body":"Hi,\r\n\r\nwe monitor an exim log file using mtail that gets regularly rotated.\r\n\r\nAnd sadly, frequently (but not always) mtail fails and fills its own log file with:\r\n\r\n```\r\nI0402 10:43:06.053308    2930 tail.go:139] read /var/log/exim4/mainlog: bad file descriptor\r\n```\r\n\r\nIt there anything we can do here or is that some bug in mtail?  Anyone else experiencing this?"},"comment":{"url":"https://api.github.com/repos/google/mtail/issues/comments/204948041","html_url":"https://github.com/google/mtail/issues/17#issuecomment-204948041","issue_url":"https://api.github.com/repos/google/mtail/issues/17","id":204948041,"user":{"login":"hynek","id":41240,"avatar_url":"https://avatars.githubusercontent.com/u/41240?v=3","gravatar_id":"","url":"https://api.github.com/users/hynek","html_url":"https://github.com/hynek","followers_url":"https://api.github.com/users/hynek/followers","following_url":"https://api.github.com/users/hynek/following{/other_user}","gists_url":"https://api.github.com/users/hynek/gists{/gist_id}","starred_url":"https://api.github.com/users/hynek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hynek/subscriptions","organizations_url":"https://api.github.com/users/hynek/orgs","repos_url":"https://api.github.com/users/hynek/repos","events_url":"https://api.github.com/users/hynek/events{/privacy}","received_events_url":"https://api.github.com/users/hynek/received_events","type":"User","site_admin":false},"created_at":"2016-04-03T11:35:21Z","updated_at":"2016-04-03T11:35:21Z","body":"I did that but tonight I found an entry that may solve the mystery:\r\n\r\n```\r\nI0403 00:00:02.282011    4924 tail.go:212] Seek to start on /var/log/exim4/mainlog\r\nI0403 00:00:02.283560    4924 tail.go:244] Failed to open \"/var/log/exim4/mainlog\" for reading: open /var/log/exim4/mainlog: perm\r\nMission denied\r\n```\r\n\r\nI believe the rotation act contains a chmod step which is a race condition and mtail doesn’t try again to open the file.\r\n\r\nAs a temporary fix, I’m running mtail as root but it would be nice if mtail could handle this error properly. "}}