{"id":41452280,"url":"https://github.com/cainky/logtap","last_synced_at":"2026-01-23T15:29:43.593Z","repository":{"id":178687530,"uuid":"661685500","full_name":"cainky/logtap","owner":"cainky","description":"A CLI-first log access tool for Unix systems. Remote log file access without SSH.","archived":false,"fork":false,"pushed_at":"2026-01-13T21:06:34.000Z","size":329,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-15T08:05:12.739Z","etag":null,"topics":["log-monitoring","logging-and-metrics","unix"],"latest_commit_sha":null,"homepage":"https://cainky.github.io/logtap/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cainky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"cainky"}},"created_at":"2023-07-03T12:22:46.000Z","updated_at":"2026-01-13T21:06:37.000Z","dependencies_parsed_at":"2023-07-19T05:20:57.959Z","dependency_job_id":"e282c110-538c-4ac8-b015-4d1c9e0bfce3","html_url":"https://github.com/cainky/logtap","commit_stats":null,"previous_names":["cainky/flasklogmonitor","cainky/unixlogmonitor","cainky/logtap"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cainky/logtap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2Flogtap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2Flogtap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2Flogtap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2Flogtap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cainky","download_url":"https://codeload.github.com/cainky/logtap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2Flogtap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28694567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T14:15:13.573Z","status":"ssl_error","status_checked_at":"2026-01-23T14:09:05.534Z","response_time":59,"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":["log-monitoring","logging-and-metrics","unix"],"created_at":"2026-01-23T15:29:42.883Z","updated_at":"2026-01-23T15:29:43.561Z","avatar_url":"https://github.com/cainky.png","language":"Python","funding_links":["https://github.com/sponsors/cainky"],"categories":[],"sub_categories":[],"readme":"# logtap\n\n[![PyPI version](https://badge.fury.io/py/logtap.svg)](https://badge.fury.io/py/logtap)\n[![Tests](https://github.com/cainky/logtap/actions/workflows/tests.yml/badge.svg)](https://github.com/cainky/logtap/actions/workflows/tests.yml)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)\n\n**A CLI-first log access tool for Unix systems. Remote log file access without SSH.**\n\n\u003e The simplest way to access log files remotely. No database. No complex setup.\n\n## Features\n\n- **Remote Log Access** - Query log files via REST API without SSH\n- **Beautiful CLI** - Colored output with rich formatting\n- **Regex Search** - Powerful filtering with regex patterns\n- **Real-time Streaming** - Follow logs like `tail -f` (WebSocket)\n- **Lightweight** - No database required, minimal dependencies\n- **Secure** - Optional API key authentication\n- **Docker Ready** - One-command deployment\n\n## Quick Start\n\n### Installation\n\n```bash\npip install logtap\n```\n\nOr with Docker:\n\n```bash\ndocker pull cainky/logtap\n```\n\n### Start the Server\n\nOn the machine with log files:\n\n```bash\nlogtap serve\n```\n\nWith authentication:\n\n```bash\nlogtap serve --api-key your-secret-key\n```\n\n### Query Logs\n\nFrom anywhere:\n\n```bash\n# Basic query\nlogtap query syslog\n\n# Search for errors\nlogtap query syslog --term \"error\"\n\n# Regex search\nlogtap query auth.log --regex \"Failed password.*root\"\n\n# Last 100 lines\nlogtap query syslog --limit 100\n\n# From a remote server\nlogtap query syslog --server http://myserver:8000 --api-key secret\n```\n\n### List Available Files\n\n```bash\nlogtap files\n```\n\n### Real-time Streaming\n\n```bash\nlogtap tail syslog --follow\n```\n\n## CLI Commands\n\n| Command | Description |\n|---------|-------------|\n| `logtap serve` | Start the API server |\n| `logtap query \u003cfile\u003e` | Query log files |\n| `logtap tail \u003cfile\u003e` | Tail logs (with `--follow` for streaming) |\n| `logtap files` | List available log files |\n\n### Common Options\n\n```bash\n# Server options\nlogtap serve --host 0.0.0.0 --port 8000\nlogtap serve --api-key mysecret --log-dir /var/log\n\n# Client options\nlogtap query syslog --server http://host:8000 --api-key mysecret\nlogtap query syslog --term \"error\" --limit 50\nlogtap query syslog --regex \"pattern\" --ignore-case\nlogtap query syslog --output json  # json, plain, pretty\n```\n\n## API Reference\n\n### GET /logs\n\nQuery log file contents.\n\n**Parameters:**\n| Parameter | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `filename` | string | `syslog` | Log file name |\n| `term` | string | - | Substring to search for |\n| `regex` | string | - | Regex pattern to match |\n| `limit` | int | `50` | Number of lines (1-1000) |\n| `case_sensitive` | bool | `true` | Case-sensitive search |\n\n**Example:**\n```bash\ncurl \"http://localhost:8000/logs?filename=syslog\u0026term=error\u0026limit=10\"\n```\n\n**Response:**\n```json\n{\n  \"lines\": [\"Jan 8 10:23:45 server error: connection failed\", \"...\"],\n  \"count\": 10,\n  \"filename\": \"syslog\"\n}\n```\n\n### GET /files\n\nList available log files.\n\n```bash\ncurl \"http://localhost:8000/files\"\n```\n\n### GET /health\n\nHealth check endpoint.\n\n```bash\ncurl \"http://localhost:8000/health\"\n```\n\n### Authentication\n\nIf `LOGTAP_API_KEY` is set, all requests require the `X-API-Key` header:\n\n```bash\ncurl -H \"X-API-Key: your-secret\" \"http://localhost:8000/logs\"\n```\n\n## Configuration\n\n### Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `LOGTAP_HOST` | `0.0.0.0` | Server bind host |\n| `LOGTAP_PORT` | `8000` | Server bind port |\n| `LOGTAP_LOG_DIRECTORY` | `/var/log` | Log files directory |\n| `LOGTAP_API_KEY` | - | API key (optional) |\n\n### Using .env File\n\nCreate a `.env` file:\n\n```env\nLOGTAP_LOG_DIRECTORY=/var/log\nLOGTAP_API_KEY=your-secret-key\n```\n\n## Docker Deployment\n\n### Using Docker Compose\n\n```yaml\nversion: \"3.8\"\n\nservices:\n  logtap:\n    image: cainky/logtap\n    ports:\n      - \"8000:8000\"\n    volumes:\n      - /var/log:/var/log:ro\n    environment:\n      - LOGTAP_API_KEY=your-secret-key\n```\n\n```bash\ndocker-compose up -d\n```\n\n### Using Docker Directly\n\n```bash\ndocker run -d \\\n  -p 8000:8000 \\\n  -v /var/log:/var/log:ro \\\n  -e LOGTAP_API_KEY=your-secret \\\n  cainky/logtap\n```\n\n## Development\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/cainky/logtap.git\ncd logtap\n\n# Install dependencies\npoetry install\n\n# Run tests\npoetry run pytest\n\n# Run the server in development mode\npoetry run logtap serve --reload\n```\n\n### Project Structure\n\n```\nlogtap/\n├── src/logtap/\n│   ├── api/          # FastAPI server\n│   ├── cli/          # Typer CLI commands\n│   ├── core/         # Core business logic\n│   └── models/       # Pydantic models\n├── tests/\n│   ├── unit/         # Unit tests\n│   └── integration/  # API tests\n├── Dockerfile\n└── docker-compose.yml\n```\n\n### Running Tests\n\n```bash\n# All tests\npoetry run pytest\n\n# With coverage\npoetry run pytest --cov=logtap\n\n# Specific test file\npoetry run pytest tests/unit/test_reader.py\n```\n\n## Security Considerations\n\n- **Path Traversal Protection**: Filenames are validated to prevent `../` attacks\n- **Input Validation**: Search terms limited to 100 chars, limits capped at 1000\n- **Read-Only**: Log directory is mounted read-only in Docker\n- **API Authentication**: Optional API key for production use\n\n## License\n\nGPL v3 License - see [LICENSE](LICENSE) for details.\n\n## Contributing\n\nContributions are welcome! Please open an issue to discuss potential changes before submitting a pull request.\n\n## Author\n\nKyle Cain - [@cainky](https://github.com/cainky)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcainky%2Flogtap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcainky%2Flogtap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcainky%2Flogtap/lists"}