Skip to content

asteriske/translogrify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Log combiner and processor: translogrify

Translogrify is designed to limit the deluge of log emails that occurs in technical emails.

How it works

Rather than have individual alerts send emails on their own, translogrify collects each alert into a row of a MySQL table along with a severity code and a list of its intended recipents. On demand, emails can then be sent per-recipient with a given lookback and severity level.

Installation

Translogrify can be installed from github:

git clone https://github.com/asteriske/translogrify.git ~/translogrify

pip install ~/translogrify

After installing, update ~/.translogrify.conf with settings appropriate to your environment:

[DEFAULT]
mailfromaddr = fromaddr
mysqlpass = mysqlpass
mailpass = mailpass
table = log
mysqlhost = mysqlhost
mysqluser = mysqluser
db = translogrify 
mailserver = server
port = 587
requires_email_login = True

Currently unauthenticated SMTP on port 25 and TLS on port 587 are supported.

Assign a MySQL user with CREATE privileges and then run

$ create_db_and_table

which will create the log db as specified in .translogrify.conf. This step can be skipped and the table be created manually, in which case mysqluser will only need write privileges.

Usage

A new line is added to the log with an invocation like the following:

$ log_update MESSAGE ALERT_LEVEL EMAIL1 EMAIL2 ...

To send email digests to each user with their messages from the last 12 hours with severity >= 3,

$ send_tgy_email --lookback 6 --minlevel 1 

Alternatively, it can be used from within a python script:

from translogrify import add_log_line, send_log_emails

add_log_line("my log message",3,["addr@email.com","anotheraddr@email.com"])

send_log_emails(lookback_hr=12,min_level=1)

Each recipient will then get a personalized color-coded priority-sorted email like this:

translogrify example

One possible configuration is to set a cron to deliver severity 5 messages every one hour and severity <= 5 every six hours.

About

Log combiner and processor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages