

GitHub - muhammadmuzzammil1998/Log-mailer: Log mailer is a program I made to ema...
source link: https://github.com/muhammadmuzzammil1998/Log-mailer
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
Log mailer 
Log mailer is a program I made to email log files from a server to me so I don't have to manually check logs everytime. It uses GoLang's "net/smtp"
to email.
Build
Prerequisites: Git, Go, SMTP server credentials.
$ git clone https://github.com/muhammadmuzzammil1998/Log-mailer
$ cd Log-mailer
$ go get github.com/tidwall/gjson
$ go build
Generating configuration file.
$ ./Log-mailer -generate Location to store configuration file (default: ./configuration.json): Enter "From" name: Muhammad Muzzammil Enter "From" email: [email protected] Enter "To" name: Muhammad Muzzammil Enter "To" email: [email protected] Enter subject: Error logs from server Enter SMTP server: smtp.server.lnk Port: 25 Username: [email protected] Password: r34lly53cur3p455w0rd Location of logs: /path/to/logs.log Interval: 6h Reset log file? (y/n): y Configuration file generated: configuration.json.
Description
Input Description Configuration File A single file to store data. Default is./configuration.json
in current directory.
"From" data
The author of the message. Used for "From" header
"To" data
The address of the primary recipient of the message. Used for "To" Header
"Subject"
What you want the subject to be. Used for "Subject" header.
SMTP Server
Link to your mail server.
Port
Port to use for the server.
Username
Username for SMTP server
Password
Password for SMTP server
Location
Location of the log file which is to be emailed
Interval
The duration in which email is repeated. Valid units are "ns", "us", "ms", "s", "m", "h"
.
Reset logfile
Empties the log file after a successful email.
JSON structure of configuration file
{ "from": { "name": "Muhammad Muzzammil", "email": "[email protected]" }, "to": { "name": "Muhammad Muzzammil", "email": "[email protected]" }, "subject": "Error logs from server", "server": "smtp.server.lnk", "port": "25", "credentials": { "user": "[email protected]", "password": "r34lly53cur3p455w0rd" }, "logs": "/path/to/logs.log", "interval": "6h", "reset": "true" }
Starting Log mailer
Using default (configuration.json) configuration
$ ./Log-mailer
Using different configurations
$ ./Log-mailer -conf [filename]
You can start it as different background processes with -conf
flag and different configurations for multiple log files.
Help
Usage of ./Log-mailer:
-conf string
Path to configuration file. (default "configuration.json")
-generate
Generate configuration file.
Recommend
-
37
README.md catsay
-
15
Asynchronous email deliveries using Resque and resque_action_mailer_backend If you have ever sent emails using ActionMailer during a user request you probably noticed that if the email sending fails or ta...
-
10
Accessing the current request object on your mailer templates to generate links A common issue with mailer templates is that as they’re not being called from a controller you can’t get your hands on the r...
-
21
-
16
Outsourcing mail and the mailer daemon blackhole trap Yesterday's post about bad Postfix settings reminded me of something else which used to create support tickets. It w...
-
16
Action Mailer: All mail comes from MAILER DAEMON Posted: 2007-06-20 - Last updated: 2019-06-05 Tagged
-
8
每一帧都是艺术,「Ema」的微笑是最美的毒 03:10
-
8
Composability and generic routes in Ema 0.8 tldr: Announcing a rewrite of
-
3
README.adoc
-
6
君实生物PD-1欧洲上市申请获EMA受理2022/12/06 12:09|作者
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK