DEV Community

Cover image for How to send application logs to Telegram in Laravel.

How to send application logs to Telegram in Laravel.

Ridwan Kasim on January 08, 2023

The Laravel framework has a robust logging system that allows you to send log messages to files, system logs, and various other destinations. Loggi...
Collapse
 
devasaka profile image
Dev to Dev •

How to send the messages to private groups?

Collapse
 
dotmarn profile image
Ridwan Kasim •

This is currently not possible using the Telegram. You can check my article here on integrating with Slack as Slack allows this. @devasaka

Collapse
 
hafidm93 profile image
Hafid •

now it's possible. just change change channel id with chat id

Collapse
 
dotmarn profile image
Ridwan Kasim •

Awesome! Thank you for this.

Collapse
 
minkhantnaung profile image
Min Khant Naung •

I created a small package for this - github.com/MinKhantNaung/laravel-t...

Collapse
 
mahdi_bagheri profile image
Mahdi Bagheri • • Edited

I created a composer package for sending log to telegram
github.com/mbpcoder/laravel-monolo...
it has some cool features

  • Sending logs to different topic
  • Chose the topic based on PHP Annotations (Attributes)
  • Add tags to logs
  • Include Stack trace, Exception file and Line
  • Include user IP and URL , ...
  • Send logs with a Async job
  • ...

Screen shot of telegram message

Collapse
 
dotmarn profile image
Ridwan Kasim •

This is lovely.

Collapse
 
minkhantnaung profile image
Min Khant Naung •

I created a small package for this — github.com/MinKhantNaung/laravel-t...

Collapse
 
dotmarn profile image
Ridwan Kasim •

Awesome!

Collapse
 
-jeff- profile image
Jeff •

We need to change the channel type to public

Does this mean the resulting channel will be publicly accessible, and by implication the logs posted to it?

Collapse
 
dotmarn profile image
Ridwan Kasim •

Yeah, so you don't send critical info to the channel. You can set the log_level for the channel etc.