marekmiklusek/telegram-logger
marekmiklusek/telegram-logger adds a Laravel logging channel that sends application logs to Telegram chats via the Bot API. Configure the bot token, chat ID, and minimum log level to receive real-time error alerts and monitor events directly in Telegram.
Architecture fit
telegram-logger is a Laravel logging channel: it plugs in behind Log::error()/Monolog, so it requires no changes to application code or to existing log call sites. Adoption cost is configuration, not refactoring.laravel/framework to illuminate/support + illuminate/contracts is a genuine architectural improvement for a TPM: the package becomes composable in Laravel-adjacent contexts (Lumen-style or standalone Silex/Console apps using Illuminate components) and reduces dependency-resolution contention in large multi-package applications.Integration feasibility
vendor:publish --tag=telegram-logger-config. All settings are exposed via .env, which fits existing 12-factor secret management. No migration scripts, no schema, no queue worker required.Technical risk
| Risk | Severity | Notes |
|---|---|---|
| PHP 8.4 / Laravel 13 requirement | Medium | Blocks immediate adoption on 8.2/8.3 estates; forces a two-track version policy across the fleet |
| Message layout change | Medium | Anything downstream that parses chat output (alert-routing bots, grep-based runbooks, screenshots in support docs) may need updating |
| Third-party data egress | Medium–High | Log payloads leave the perimeter into Telegram. Redaction is key-name based, so unlisted PII (emails, order IDs, free-text context) still ships |
| Cache-dependent flood protection | Low | Gracefully skipped when no cache exists — logging never blocks, but dedupe guarantees are best-effort |
| Runtime exceptions from the log listener | Low (now) | The v1 defect where a malformed exception message or null config could propagate into calling code was a real availability risk; v2 fixes it |
Key questions
dedupe_seconds / max_per_minute, and is it shared or per-app? Shared caches change dedupe semantics across environments.Stack fit
logging.php channel stack; it is an additive channel, not a replacement for file/stdout/Sentry logging. Recommended posture is "second channel for high-severity events only," not a primary log sink.level is now validated at boot against PSR-3, misconfiguration fails fast and loudly rather than silently sending nothing — helpful for standardising a channel template across many repos.Migration path
^1.0 explicitly in composer.json so a routine composer update cannot accidentally attempt the major bump.throw_on_failure=true so delivery problems surface immediately instead of being swallowed.--force in the pilot, review the diff for new keys, and backfill values via .env rather than editing the published file — keeps config portable and secret-free.redact_keys deliberately: start from the shipped defaults and extend with the organisation's domain-specific sensitive fields (e.g. email, card, ssn, session_id).max_per_minute and dedupe_seconds conservatively for the first two weeks, then tune against observed volume.Compatibility
api_url, base_path, throw_on_failure) are only discoverable in the published file. Document the new keys in the internal runbook regardless.api_url is the only supported path and requires the proxy to accept POST.Sequencing
Runtime upgrade → package bump → config republish + .env extension → staging validation with throw_on_failure → layout review by whoever consumes chat output → production canary → fleet.
Maintenance
illuminate/* dependency surface reduces the frequency of forced upgrades caused by unrelated Laravel releases.Support
throw_on_failure, the plain-text retry on HTTP 400, and the actionable error when allow_url_fopen is disabled all convert silent failures into visible ones.level and the UTF-8 / MarkdownV2 escaping fixes remove a class of "message arrived mangled" tickets.Scaling
max_per_minute; this is the right control for a chat-based sink, where the real constraint is human attention and Telegram's own limits, not throughput.level set to error/critical) plus aggregation, with Telegram reserved for the pager-worthy subset.Failure modes
| Failure | Behaviour in v2 | Operational note |
|---|---|---|
| Telegram API returns 400 (formatting) | Automatic plain-text retry | Message arrives unformatted; still delivered |
| Invalid token / wrong chat ID | Now visible via API response; throws only if throw_on_failure |
Previously indistinguishable from success |
| Network timeout / Telegram outage | Message lost after retry; log call returns | Consider throw_on_failure in staging only — enabling it in production reintroduces the "logging takes the app down" risk the release was fixing |
| Cache unavailable | Dedupe and rate-limit skipped, delivery continues | Fail-open by design; brief message bursts possible |
| Oversized message | Truncated on character boundaries with Markdown entities intact | Fixed regression from 1.x |
| Malformed exception message / null config | No longer throws into calling code | Availability fix |
| Sensitive values in context | Redacted only if key is listed in redact_keys |
Residual compliance exposure; requires governance, not just config |
Ramp-up
.env, staging verification), and under an hour per subsequent app once a channel template and .env convention exist.How can I help you explore Laravel packages today?