{"id":26471109,"url":"https://github.com/mstgnz/golog","last_synced_at":"2026-04-21T22:01:01.625Z","repository":{"id":281479834,"uuid":"945323918","full_name":"mstgnz/golog","owner":"mstgnz","description":"Real-time Log Monitoring Tool","archived":false,"fork":false,"pushed_at":"2025-03-09T12:14:56.000Z","size":9440,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-02T13:39:19.469Z","etag":null,"topics":["go","logging","postgres","real-time"],"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/mstgnz.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":"2025-03-09T06:27:32.000Z","updated_at":"2025-03-18T18:36:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"091e6eb4-e7ac-46b4-853d-98f78e00cd89","html_url":"https://github.com/mstgnz/golog","commit_stats":null,"previous_names":["mstgnz/golog"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mstgnz/golog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstgnz%2Fgolog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstgnz%2Fgolog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstgnz%2Fgolog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstgnz%2Fgolog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mstgnz","download_url":"https://codeload.github.com/mstgnz/golog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstgnz%2Fgolog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32112030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["go","logging","postgres","real-time"],"created_at":"2025-03-19T20:28:39.790Z","updated_at":"2026-04-21T22:01:01.619Z","avatar_url":"https://github.com/mstgnz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoLog\n\n[![CI](https://github.com/mstgnz/golog/actions/workflows/ci.yml/badge.svg)](https://github.com/mstgnz/golog/actions/workflows/ci.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/mstgnz/golog)](https://goreportcard.com/report/github.com/mstgnz/golog)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nReal-time log monitoring tool powered by PostgreSQL LISTEN/NOTIFY.\n\nGoLog provides a lightweight, zero-dependency log pipeline: your application inserts a row into the `logs` table and every connected client (web dashboard or CLI) receives the entry instantly -- no polling, no message queue.\n\n## Features\n\n- **Real-time streaming** via PostgreSQL LISTEN/NOTIFY and Server-Sent Events (SSE)\n- **Web dashboard** with live filtering by level and type\n- **CLI tool** with colored output and `-level` / `-type` flags\n- **REST API** for inserting and querying logs\n- **Input validation** enforcing allowed levels and types\n- **Docker Compose** setup for instant local development\n\n## Architecture\n\n```\nYour app\n  |\n  | INSERT INTO logs (level, type, message)\n  v\nPostgreSQL  ──NOTIFY log_channel──\u003e  GoLog server\n                                          |\n                          ┌───────────────┴───────────────┐\n                          v                               v\n                    Web dashboard                    CLI tool\n                  (SSE /api/logs/stream)       (LISTEN goroutine)\n```\n\nThe PostgreSQL trigger `log_notify_trigger` fires on every insert and publishes a JSON payload on `log_channel`. The GoLog server holds a persistent `pq.Listener` and fans the notification out to every connected SSE client.\n\n## Getting started\n\n### With Docker Compose (recommended)\n\n```bash\ngit clone https://github.com/mstgnz/golog.git\ncd golog\ndocker-compose up\n```\n\nOpen http://localhost:8080 in your browser.\n\n### Locally\n\n**Prerequisites:** Go 1.22+, PostgreSQL 16+\n\n```bash\ngit clone https://github.com/mstgnz/golog.git\ncd golog\n\n# Configure database connection\ncp .env.example .env   # edit DB_* variables\n\n# Initialize schema and sample data\npsql -U postgres -d golog -f init.sql\n\n# Build\nmake build\n\n# Start the web server\n./golog-server\n\n# In a second terminal, start the CLI\n./golog-cli\n```\n\n## CLI usage\n\n```bash\n./golog-cli                          # stream all logs\n./golog-cli -level=ERROR             # filter by level\n./golog-cli -type=DATABASE           # filter by type\n./golog-cli -level=ERROR -type=AUTH  # combine filters\n```\n\nSupported levels: `INFO`, `WARNING`, `ERROR`, `DEBUG`\n\nSupported types: `SYSTEM`, `AUTH`, `DATABASE`, `USER`, `API`\n\n## API reference\n\n### GET /api/logs\n\nReturns the most recent 100 log entries, newest first.\n\n**Query parameters** (all optional):\n\n| Parameter | Description | Example |\n|-----------|-------------|---------|\n| `level` | Filter by log level | `level=ERROR` |\n| `type` | Filter by log type | `type=DATABASE` |\n\n**Response**\n\n```json\n[\n  {\n    \"id\": 42,\n    \"timestamp\": \"2024-01-15T10:30:00Z\",\n    \"level\": \"ERROR\",\n    \"type\": \"DATABASE\",\n    \"message\": \"Connection timeout\"\n  }\n]\n```\n\n### POST /api/logs\n\nInsert a new log entry.\n\n**Request body**\n\n```json\n{\n  \"level\": \"INFO\",\n  \"type\": \"SYSTEM\",\n  \"message\": \"Application started\"\n}\n```\n\n**Response**\n\n```json\n{ \"id\": 43 }\n```\n\n**Validation errors** return `400 Bad Request` with a plain-text description.\n\n### GET /api/logs/stream\n\nServer-Sent Events stream. Each event is a JSON-encoded log entry:\n\n```\ndata: {\"id\":43,\"timestamp\":\"2024-01-15T10:30:01Z\",\"level\":\"INFO\",\"type\":\"SYSTEM\",\"message\":\"Application started\"}\n\n```\n\n**Query parameters:** same `level` and `type` filters as `GET /api/logs`.\n\n## Running tests\n\n```bash\nmake test          # unit + mock tests\nmake test-race     # with race detector\nmake test-coverage # HTML coverage report\nmake lint          # vet + format check\n```\n\n## Development\n\n```bash\nmake build         # build both binaries\nmake run           # go run web server\nmake run-cli       # go run CLI tool\nmake vet           # go vet ./...\nmake fmt           # gofmt -w .\nmake docker-build  # build Docker image\nmake docker-run    # docker-compose up\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on setting up the dev environment, code style, and the pull request workflow.\n\n## Security\n\nFor security issues please see [SECURITY.md](SECURITY.md) rather than opening a public issue.\n\n## License\n\nMIT -- see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmstgnz%2Fgolog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmstgnz%2Fgolog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmstgnz%2Fgolog/lists"}