{"id":34126515,"url":"https://github.com/psyb0t/telegram-logger","last_synced_at":"2026-03-12T04:31:36.461Z","repository":{"id":65187831,"uuid":"579931602","full_name":"psyb0t/telegram-logger","owner":"psyb0t","description":"HTTP service that receives log entries as JSON and sends them to users via a Telegram bot.","archived":false,"fork":false,"pushed_at":"2024-07-06T00:22:35.000Z","size":127,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-17T10:14:39.989Z","etag":null,"topics":["golang","golang-package","logger","logging","telegram","telegram-bot"],"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/psyb0t.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-12-19T09:52:50.000Z","updated_at":"2025-10-06T09:17:04.000Z","dependencies_parsed_at":"2024-01-16T05:04:40.693Z","dependency_job_id":"5573e68c-ce19-4149-8a01-3826c5ca33ca","html_url":"https://github.com/psyb0t/telegram-logger","commit_stats":{"total_commits":39,"total_committers":1,"mean_commits":39.0,"dds":0.0,"last_synced_commit":"17b9acd0eaf56de5c7edeca8a23abc7fc9e0f25b"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/psyb0t/telegram-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyb0t%2Ftelegram-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyb0t%2Ftelegram-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyb0t%2Ftelegram-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyb0t%2Ftelegram-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psyb0t","download_url":"https://codeload.github.com/psyb0t/telegram-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyb0t%2Ftelegram-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30415472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T04:25:42.844Z","status":"ssl_error","status_checked_at":"2026-03-12T04:25:34.624Z","response_time":114,"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":["golang","golang-package","logger","logging","telegram","telegram-bot"],"created_at":"2025-12-14T23:42:41.855Z","updated_at":"2026-03-12T04:31:36.444Z","avatar_url":"https://github.com/psyb0t.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# telegram-logger: Hack Your Logs\n\nWelcome to `telegram-logger`, where we turn your logs into Telegram messages. Because logs should be as mobile as you are.\n\n## Table of Contents\n\n- [What's This?](#whats-this)\n- [Configuration](#configuration)\n- [HTTP API](#http-api)\n- [Telegram Bot](#telegram-bot)\n- [Running the Service](#running-the-service)\n- [Interacting with the Service](#interacting-with-the-service)\n- [Available Clients](#available-clients)\n- [TODO](#todo)\n\n## What's This?\n\n`telegram-logger` is a server that receives log entries via HTTP POST requests and sends them to a Telegram chat instance. It's like having a secret agent for your logs.\n\n## Configuration\n\nYour config file is the key to the kingdom. Here's what you can tweak:\n\n```yaml\nlistenAddress: 0.0.0.0:8080\nlogger:\n  level: debug\n  format: json\ntelegramBot:\n  token: YOUR_SECRET_TOKEN_HERE\n  superuserChatID: 38081130\nstorage:\n  type: badgerDB\n  badgerDB:\n    dsn: /path/to/db/dir\n```\n\nPrefer environment variables? We've got you covered:\n\n```bash\nexport LISTENADDRESS=0.0.0.0:8080\nexport LOGGER_LEVEL=debug\nexport LOGGER_FORMAT=json\nexport TELEGRAMBOT_TOKEN=YOUR_SECRET_TOKEN_HERE\nexport TELEGRAMBOT_SUPERUSERCHATID=38081130\nexport STORAGE_TYPE=badgerDB\nexport STORAGE_BADGERDB_DSN=/path/to/db/dir\n```\n\n## HTTP API\n\nSend a POST request with your log entry. Don't forget your secret handshake (X-ID header).\n\n```json\n{\n  \"caller\": \"myService\",\n  \"time\": \"2022-03-11T12:34:56.789Z\",\n  \"level\": \"error\",\n  \"message\": \"Something went wrong!\",\n  \"error\": \"Error: XYZ\",\n  \"requestID\": \"abc123\",\n  \"traceID\": \"def456\",\n  \"spanID\": \"ghi789\",\n  \"data\": {\n    \"someKey\": \"someValue\",\n    \"anotherKey\": 123\n  }\n}\n```\n\n## Telegram Bot\n\nOur bot's got a few commands that you can throw at it:\n\n- `/start`: Get your unique ID\n- `/stop`: Go dark\n- `/getAllUsers`: For the admins\n- `/addUser`: Recruit new agents (admin only) - a user can also be a channel\n\nPro Tip: Adding a channel? Here's how:\n\n1. Send a message to your target channel\n2. Grab the channel ID from the message URL (e.g., https://t.me/c/2340157712/5)\n3. Add the prefix: `-100`\n4. Use the command: `/addUser -1002340157712`\n5. Grab the ID that the bot sends to the channel(and maybe delete that message) and use it as your `X-ID` header when doing your HTTP request.\n\n## Running the Service\n\n### Docker\n\n```bash\ndocker run -it \\\n    --env CONFIGFILE=/app/config.yml \\\n    --env LOGGER_LEVEL=debug \\\n    --env LOGGER_FORMAT=json \\\n    --env TELEGRAMBOT_TOKEN=TOKEN \\\n    --env TELEGRAMBOT_SUPERUSERCHATID=CHATID \\\n    --env STORAGE_TYPE=badgerDB \\\n    --env STORAGE_BADGERDB_DSN=/app/db \\\n    --mount type=bind,src=$(pwd)/config.yml,dst=/app/config.yml,readonly \\\n    --mount type=bind,src=$(pwd)/db,dst=/app/db \\\n    -p 0.0.0.0:8080:80 \\\n    psyb0t/telegram-logger\n```\n\n### Docker Compose\n\n```yaml\nversion: \"3.8\"\nservices:\n  server:\n    image: psyb0t/telegram-logger\n    ports:\n      - 8080:80\n    volumes:\n      - ./config.yml:/app/config.yml:ro\n      - ./db:/app/db\n    environment:\n      - CONFIGFILE=/app/config.yml\n      - LOGGER_LEVEL=debug\n      - LOGGER_FORMAT=json\n      - TELEGRAMBOT_TOKEN=TOKEN\n      - TELEGRAMBOT_SUPERUSERCHATID=CHATID\n      - STORAGE_TYPE=badgerDB\n      - STORAGE_BADGERDB_DSN=/app/db\n```\n\nFire it up:\n\n```bash\ndocker compose -f docker-compose.yml up\n```\n\n### Binary\n\nFirst, get the latest binary:\n\n```bash\n#!/usr/bin/env bash\nowner=psyb0t\nrepo=telegram-logger\nasset_name=telegram-logger-linux-amd64\n\necho \"Looking up the latest release of $asset_name for github.com/$owner/$repo...\"\nreleases=$(curl -s https://api.github.com/repos/$owner/$repo/releases)\nlatest_release=$(echo \"$releases\" | jq -r '.[0]')\nasset_url=$(echo \"$latest_release\" | jq -r \".assets[] | select(.name == \\\"$asset_name\\\") | .browser_download_url\")\n\necho \"Downloading $asset_url...\"\ncurl -s -L -o \"$asset_name\" \"$asset_url\"\n\nchmod +x \"$asset_name\"\n```\n\nThen run it:\n\n```bash\nexport LISTENADDRESS=0.0.0.0:8080\nexport LOGGER_LEVEL=debug\nexport LOGGER_FORMAT=json\nexport TELEGRAMBOT_TOKEN=YOUR_SECRET_TOKEN_HERE\nexport TELEGRAMBOT_SUPERUSERCHATID=YOUR_CHAT_ID_HERE\nexport STORAGE_TYPE=badgerDB\nexport STORAGE_BADGERDB_DSN=./db\n\n./telegram-logger-linux-amd64\n```\n\n## Interacting with the Service\n\nTime to put it to the test:\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -H \"X-ID: YOUR_SECRET_ID\" -d '{\n  \"caller\": \"myService\",\n  \"time\": \"2022-03-11T12:34:56.789Z\",\n  \"level\": \"warning\",\n  \"message\": \"Something went wrong!\",\n  \"error\": \"Error: XYZ\",\n  \"requestID\": \"abc123\",\n  \"traceID\": \"def456\",\n  \"spanID\": \"ghi789\",\n  \"data\": {\n    \"someKey\": \"someValue\",\n    \"anotherKey\": 123\n  }\n}' http://localhost:8080/\n```\n\n## Available Clients\n\n- https://github.com/psyb0t/py-telegram-logger-client: For the Pythonistas (module and executable)\n\nMore clients in the pipeline. Stay tuned.\n\n## TODO\n\n- More config validation\n- Add healthcheck\n- Add trace id to logs\n- Create external wrapper package based on telegramBotMessageHandler\n- Build embeddable helper packages to interact with a deployed service\n- Fix linting\n- SQLITE support\n\nNow go forth and hack those logs! 🖥️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsyb0t%2Ftelegram-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsyb0t%2Ftelegram-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsyb0t%2Ftelegram-logger/lists"}