1
0
mirror of https://github.com/ManyakRus/telegram_loki.git synced 2024-12-12 09:33:50 +02:00
Go to file
2024-09-27 11:01:30 +03:00
bin сделал Pause_ctx() 2024-09-27 11:01:19 +03:00
cmd новый 2023-10-11 18:04:49 +03:00
docs сделал если только ошибки - то напишем в телеграм 2024-09-13 11:30:54 +03:00
internal сделал Pause_ctx() 2024-09-27 11:01:19 +03:00
vendor сделал Pause_ctx() 2024-09-27 11:01:19 +03:00
.env_empty сделал TextError 2023-10-23 10:29:01 +03:00
.gitignore сделал если только ошибки - то напишем в телеграм 2024-09-13 11:30:54 +03:00
.golangci.yml сделал Pause_ctx() 2024-09-27 11:01:30 +03:00
go.mod сделал Pause_ctx() 2024-09-27 11:01:19 +03:00
go.sum сделал Pause_ctx() 2024-09-27 11:01:19 +03:00
LICENSE Create LICENSE 2024-03-19 15:49:05 +03:00
Makefile сделал Pause_ctx() 2024-09-27 11:01:19 +03:00
README.md сделал TextError 2023-10-23 10:29:01 +03:00
readme.rus сделал TextError 2023-10-23 10:29:01 +03:00

Applications for sending logs with errors from the LOKI(GRAFANA) logger to the Telegram messenger

The LOKI logger has an inconvenient interface for searching errors in application logs, and no one will look there every 5 minutes - Therefore, it is necessary to automate the process of searching for errors in logs and notifying developers.

The application does:

  1. Log in to grafana
  2. Takes a list of services from the services.txt file
  3. For each service, searches for LOKI logs with the text: error:,panic:,ERROR:,PANIC:
  4. Found logs with errors are sent to the Telegram messenger
  5. Repeats the search every 10 minutes

Installation procedure:

  1. Compile this repository make build the telegram_loki file will appear in the bin folder

  2. make a .env file with filled parameters: TELEGRAM_APP_ID= TELEGRAM_APP_HASH= TELEGRAM_PHONE_FROM= TELEGRAM_PHONE_SEND_TEST= LOKI_URL= LOKI_SEARCH_TEXT="\\[ERROR\\]|\\[PANIC\\]|level=error|level=panic"

GRAFANA_LOGIN= GRAFANA_PASSWORD= TELEGRAM_CHAT_NAME= TELEGRAM_MESSAGES_COUNT=

  1. Fill in the settings/services.txt file In json format write the service name in LOKI and the name (login) of the programmer (optional) sample: { "test-service1": "@DeveloperTelegramName" }

  2. Run the telegram_loki file

Source code in Golang language. Tested on Linux Ubuntu Readme from 10/13/2023

License: Save information about the author and the site.

Made by Alexander Nikitin https://github.com/ManyakRus/telegram_loki