{"id":38107422,"url":"https://github.com/un000/tailor","last_synced_at":"2026-01-16T21:43:04.068Z","repository":{"id":57506476,"uuid":"189778251","full_name":"un000/tailor","owner":"un000","description":"Tailor, the library for tailing logs under logrotate, written in go.","archived":false,"fork":false,"pushed_at":"2019-06-04T16:25:56.000Z","size":24,"stargazers_count":37,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T02:41:59.210Z","etag":null,"topics":["go","golang","log","nginx","tail"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/un000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-01T21:16:55.000Z","updated_at":"2025-03-19T05:41:50.000Z","dependencies_parsed_at":"2022-08-29T20:00:55.267Z","dependency_job_id":null,"html_url":"https://github.com/un000/tailor","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/un000/tailor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un000%2Ftailor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un000%2Ftailor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un000%2Ftailor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un000%2Ftailor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/un000","download_url":"https://codeload.github.com/un000/tailor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un000%2Ftailor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28483687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","log","nginx","tail"],"created_at":"2026-01-16T21:43:03.459Z","updated_at":"2026-01-16T21:43:04.061Z","avatar_url":"https://github.com/un000.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Tailor, the library for tailing logs under logrotate\n-----\n[![Go Doc](https://godoc.org/github.com/un000/tailor?status.svg)](https://godoc.org/github.com/un000/tailor)\n[![Sourcegraph](https://sourcegraph.com/github.com/un000/tailor/-/badge.svg)](https://sourcegraph.com/github.com/un000/tailor?badge)\n[![Go Report Card](https://goreportcard.com/badge/github.com/un000/tailor)](https://goreportcard.com/report/github.com/un000/tailor)\n\nTailor provides the functionality of tailing for e. g. nginx logs under logrotate.\nTailor will follow a selected log file and reopen it if it's been rotated. Now, tailor doesn't require inotify, because it polls logs\nwith a tiny delay. So the library can achieve cross-platform.\n\nThere is no plan to implement truncate detection.\n\nCurrently this library is used in production, handling 5k of opened files with a load over 100k rps per instance,\nwithout such overhead.\n![Actual usage](https://i.imgur.com/G4QICfk.png)\n\n## Install\n```Bash\ngo get github.com/un000/tailor\n```\n\n## Features\n- Tail files from any offsets\n- Reopening on logrotate\n- Rate limiter + support custom rate limiters\n- Leaky bucket\n- Performant helpers to trim or convert bytes to string\n- Lag monitoring\n\n## Example\n```Go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"time\"\n\n\t\"github.com/un000/tailor\"\n)\n\nfunc main() {\n\tt := tailor.New(\n\t\t\"./github.com_access.log\",\n\t\ttailor.WithSeekOnStartup(0, io.SeekStart),\n\t\ttailor.WithPollerTimeout(10*time.Millisecond),\n\t)\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\terr := t.Run(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Tailing file:\", t.FileName())\n\tfor {\n\t\tselect {\n\t\tcase line, ok := \u003c-t.Lines():\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfmt.Println(line.StringTrimmed())\n\t\tcase err, ok := \u003c-t.Errors():\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tpanic(err)\n\t\t}\n\t}\n}\n\n```\n\n## Contributions are appreciated, feel free ✌️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fun000%2Ftailor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fun000%2Ftailor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fun000%2Ftailor/lists"}