{"id":16696259,"url":"https://github.com/dispensable/tailsql","last_synced_at":"2026-05-07T18:14:19.453Z","repository":{"id":231737172,"uuid":"782417766","full_name":"dispensable/tailsql","owner":"dispensable","description":"Continually run sql query on tumbling/sliding window of log files records","archived":false,"fork":false,"pushed_at":"2024-04-12T15:22:30.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T17:50:45.913Z","etag":null,"topics":["duckdb","log","sql","sqlite","stream","sysadmin","tail","tools"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dispensable.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-05T09:01:37.000Z","updated_at":"2024-11-09T22:30:53.000Z","dependencies_parsed_at":"2024-06-19T12:30:49.641Z","dependency_job_id":"dd660dd0-27c2-4749-a6e6-13da093d39c7","html_url":"https://github.com/dispensable/tailsql","commit_stats":null,"previous_names":["dispensable/tailsql"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dispensable/tailsql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dispensable%2Ftailsql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dispensable%2Ftailsql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dispensable%2Ftailsql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dispensable%2Ftailsql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dispensable","download_url":"https://codeload.github.com/dispensable/tailsql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dispensable%2Ftailsql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32749830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["duckdb","log","sql","sqlite","stream","sysadmin","tail","tools"],"created_at":"2024-10-12T17:27:09.770Z","updated_at":"2026-05-07T18:14:19.438Z","avatar_url":"https://github.com/dispensable.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tailsql\n\ntailsql can continually run sql query on tumbling/sliding window of log files records.\n\n# why\n\n- when reading logs using `tail -f`, sometimes it flushs too fast to read\n- sometime you just wanna do some simple aggregation/join analytics, and awk can't express this with one line\n- you wanna aggregate data like stream job, but traditional unix tools works like batch job\n- you wanna compare two or more log files on sepecific fields but other records rushed into the small screen\n\n# usage\n\nIt's a go-stream pipeline job like:\n\n```\nlog -\u003e parse -\u003e filter -\u003e throttler -\u003e sql row \\\nlog -\u003e parse -\u003e filter -\u003e throttler -\u003e sql row -\u003e window -\u003e insert as table -\u003e run sql(duckdb/sqlite) -\u003e sink\nlog -\u003e parse -\u003e filter -\u003e throttler -\u003e sql row /\n```\n\nfor example log format like this: `2024/04/12 22:47:42.506277 GETM SUCC localhost:7710 605` (ts method result server time_used)\n\nyou can run query to analytic your log\n\n```bash\ntailsql query \\\n    -f my.log \\\n    # use capture group to parse log to table row\n    # __ is seperator before is field name after is data type\n    # now support int/float/date/str\n    -r '.+ (?P\u003cmethod__str\u003eGETM) (?P\u003cstatus__str\u003eSUCC) .+7710 (?P\u003ctime__int\u003e[0-9]+) .+' \\\n    # only contain time \u003e 10000 records\n    # filter syntax is like SQL where\n    -F 'time \u003e 10000' \\\n    -s stdout \\\n    # sliding windows, size 10s sliding interval 5s, use input time not log time\n    # you can use your logs time, just change -1 to the index of your ts capture group\n    -w '10:5:-1' \\\n    # parsed rows filtered then insert to db engine for anylytic\n    # support duckdb/sqlite/qlbridge membtree\n    -d duckdb \\\n    # format as table\n    -o table \\\n    # query\n    'select count(1) from t0 where time \u003e 12275'\n```\n\nwill get result like:\n\n```\n\u003e\u003e\u003e Press CTRL + C to quit ...\nINFO[2024-04-12T22:41:56+08:00] Query stream started, please wait 10s...\nINFO[2024-04-12T22:42:06+08:00] \u003e\u003e query result \u003c\u003c\nRun sql `select count(1) from t0 where time \u003e 12275`:\n+----------+\n| COUNT(1) |\n+----------+\n| 71       |\n+----------+\nINFO[2024-04-12T22:42:11+08:00] \u003e\u003e query result \u003c\u003c\nRun sql `select count(1) from t0 where time \u003e 12275`:\n+----------+\n| COUNT(1) |\n+----------+\n| 86       |\n+----------+\nINFO[2024-04-12T22:42:16+08:00] \u003e\u003e query result \u003c\u003c\nRun sql `select count(1) from t0 where time \u003e 12275`:\n+----------+\n| COUNT(1) |\n+----------+\n| 81       |\n+----------+\nINFO[2024-04-12T22:42:21+08:00] \u003e\u003e query result \u003c\u003c\nRun sql `select count(1) from t0 where time \u003e 12275`:\n+----------+\n| COUNT(1) |\n+----------+\n| 63       |\n+----------+\n^C\u003e\u003e\u003e User ask to quit ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdispensable%2Ftailsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdispensable%2Ftailsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdispensable%2Ftailsql/lists"}